<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Betreff: Access violation Error in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13202630#M1571</link>
    <description>&lt;P&gt;No sir.&lt;BR /&gt;I did come across that link and I managed to get anydesk from one of my users. I could not detect how or when the issue happens but I checked the computer ram, graphic card and cpu. every thing is new and updated.&lt;/P&gt;&lt;P&gt;my codes are written with .net 4.8.&lt;/P&gt;&lt;P&gt;does AuoCAD below 2020 support those libraries?&lt;/P&gt;&lt;P&gt;what I noticed is my hatch flickers with each mouse movement in 2018. but it does work. after a couple of clicks, the message popsup and AutoCAD crashes.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Dec 2024 06:06:48 GMT</pubDate>
    <dc:creator>a.kouchakzadeh</dc:creator>
    <dc:date>2024-12-10T06:06:48Z</dc:date>
    <item>
      <title>Access violation Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13200938#M1568</link>
      <description>&lt;P&gt;Hi, Im having trouble with my code.&lt;/P&gt;&lt;P&gt;Im jigging a region which I constantly hatch it by each mouse movement. its a pretty heavy process.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my jig is in a loop so every time user clicks, some objects are added to database and again ed.drag(this) to start jig again immediately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;some users face this error message and complain AutoCAD crashes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1443708i39726DA0A8B647E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Error.png" alt="Error.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this does not happen on my machine so I cant verify how or when does this happen.&lt;/P&gt;&lt;P&gt;I also Have a try catch block every where to narrow the exception location but no luck so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my code where I append entities when user clicks:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void SetBlockRefXData(Transaction tr,Sprinkler sprinkler)
{
    var xDataDictionary = new Dictionary&amp;lt;string, string&amp;gt;
    {
        {"type", InputData.SprinklerType.ToString() },
        {"spacing",InputData.PendentSpacing},
        {"coverage",InputData.PendentCoverage},
        {"deftoceiling", sprinkler.IsUnderBeam.Item1 ?
            InputData.DeflectorToBeam.ToString() : InputData.DeflectorToCeiling.ToString() },
        {"IsUnderBeam",sprinkler.IsUnderBeam.Item1.ToString() },
    };
    XDataUtil.SetXdata(tr, sprinkler.BlockReference, "BeamRuleApp", xDataDictionary);
}

public void Append(Sprinkler sprinkler,JigOptionCreator jigOptions)
{
    try
    {
        var tr = _db.TransactionManager.TopTransaction;
        var ed = ACAD.DocumentManager.GetDocument(_db).Editor;
        var curSpace = tr.GetObject(_db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
        var coveredHatch = sprinkler.CoveredHatch;

        var dst = (DimStyleTable)tr.GetObject(_db.DimStyleTableId, OpenMode.ForRead, true);
        ObjectId dstId = ObjectId.Null;
        if (!dst.Has(InputData.DimStyle))
            dstId = _db.GetDimstyleData().ObjectId;
        else
            dstId = dst[InputData.DimStyle];

        if (InputData.KeepDimensions)
        {
            if (jigOptions.DimLineA != null)
            {
                curSpace.AppendEntity(jigOptions.DimLineA);
                tr.AddNewlyCreatedDBObject(jigOptions.DimLineA, true);
            }
            if (jigOptions.DimLineB != null)
            {
                curSpace.AppendEntity(jigOptions.DimLineB);
                tr.AddNewlyCreatedDBObject(jigOptions.DimLineB, true);
            }
        }
        if (InputData.MergeHatches)
        {
            var typedValue = new TypedValue[]
            {
                new TypedValue(0, "HATCH"),
                new TypedValue(8, "NSVLayout"),
            };
            var selectionFilter = new SelectionFilter(typedValue);
            var selectionResult = ed.SelectAll(selectionFilter);
            if (selectionResult.Status == PromptStatus.OK)
            {
                var previousHatchedRegions = new Region();
                foreach (ObjectId id in selectionResult.Value.GetObjectIds())
                {
                    var hatch = tr.GetObject(id, OpenMode.ForRead) as Hatch;
                    if (hatch != null)
                    {
                        var curves = hatch.GetBoundary();
                        var curveSegments = new DBObjectCollection();
                        foreach (var curve in curves)
                        {
                            curveSegments.Add(curve);
                        }
                        foreach (Region region in Region.CreateFromCurves(curveSegments))
                        {
                            previousHatchedRegions.BooleanOperation(BooleanOperationType.BoolUnite,
                                region.Clone() as Region);
                        }
                        foreach (var curve in curves)
                        {
                            curve.Dispose();
                        }
                    }
                }
                var currentCoveredRegion = sprinkler.CoveredRegion;
                currentCoveredRegion.BooleanOperation(BooleanOperationType.BoolUnite, previousHatchedRegions);

                foreach (ObjectId id in selectionResult.Value.GetObjectIds())
                {
                    var hatch = tr.GetObject(id, OpenMode.ForWrite) as Hatch;
                    if (hatch != null)
                    {
                        hatch.Erase();
                    }
                }
                coveredHatch = HatchRegion.ToColorIndex(150, 150, currentCoveredRegion);
            }
        }
        if (coveredHatch != null)
        {
            curSpace.AppendEntity(coveredHatch);
            tr.AddNewlyCreatedDBObject(coveredHatch, true);
        }
                
        curSpace.AppendEntity(sprinkler.BlockReference);
        tr.AddNewlyCreatedDBObject(sprinkler.BlockReference, true);

        SetBlockRefXData(tr, sprinkler);

        var tpv = new TypedValue[1];
        tpv.SetValue(new TypedValue((int)DxfCode.BlockName, "NSVPENDENTTEMPSPRINKLER"), 0);
        var sprinklerFilter = new SelectionFilter(tpv);
        var sset = ed.SelectAll(sprinklerFilter);

        try
        {

            if (sset.Status != PromptStatus.OK)
                return;
            DrawOrderTable dot = tr.GetObject(curSpace.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
            var objToMove = new ObjectIdCollection(sset.Value.GetObjectIds());

            if (jigOptions.DimLineA != null &amp;amp;&amp;amp; jigOptions.DimLineA.ObjectId != ObjectId.Null)
                objToMove.Add(jigOptions.DimLineA.ObjectId);
            if (jigOptions.DimLineB != null &amp;amp;&amp;amp; jigOptions.DimLineB.ObjectId != ObjectId.Null)
                objToMove.Add(jigOptions.DimLineB.ObjectId);

            dot.MoveToTop(objToMove);
        }
        catch (Exception ex)
        {
            MessageBox.Show("Exception in draw order table");
            throw ex;
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show("Exception in entity appender");
        throw ex;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 09:55:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13200938#M1568</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2024-12-09T09:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Access violation Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13202040#M1569</link>
      <description>&lt;P&gt;Are you clients using an outdated or unsupported graphics card ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 20:53:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13202040#M1569</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2024-12-09T20:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Access violation Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13202050#M1570</link>
      <description>&lt;P&gt;or :&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/AutoCAD-FATAL-ERROR-Unhandled-Access-Violation-Reading-0xfffffffff-Exception-at-d2fea7c0h.html" target="_blank"&gt;https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/AutoCAD-FATAL-ERROR-Unhandled-Access-Violation-Reading-0xfffffffff-Exception-at-d2fea7c0h.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 20:56:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13202050#M1570</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2024-12-09T20:56:43Z</dc:date>
    </item>
    <item>
      <title>Betreff: Access violation Error</title>
      <link>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13202630#M1571</link>
      <description>&lt;P&gt;No sir.&lt;BR /&gt;I did come across that link and I managed to get anydesk from one of my users. I could not detect how or when the issue happens but I checked the computer ram, graphic card and cpu. every thing is new and updated.&lt;/P&gt;&lt;P&gt;my codes are written with .net 4.8.&lt;/P&gt;&lt;P&gt;does AuoCAD below 2020 support those libraries?&lt;/P&gt;&lt;P&gt;what I noticed is my hatch flickers with each mouse movement in 2018. but it does work. after a couple of clicks, the message popsup and AutoCAD crashes.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 06:06:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/access-violation-error/m-p/13202630#M1571</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2024-12-10T06:06:48Z</dc:date>
    </item>
  </channel>
</rss>

