AccessViolationException was unhandled by user code

01-12-2012 12:25 AM
New Contributor
I got an access violation exception from my code. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Stack Trace of exception
   at ESRI.ArcGIS.Display.IDynamicDisplay.DrawPolygon(IPointCollection pointCollection)
   at ndGISMAP.ClassFiles.DynamicLayers.DynamicPolygonLayer.DrawDynamicLayer(esriDynamicDrawPhase DynamicDrawPhase, IDisplay Display, IDynamicDisplay DynamicDisplay) in D:\Tools\DynamicLayers\DynamicPolygonLayer.cs:line 264

i have uploaded my code

Thanks for your helps
0 Kudos
2 Replies
New Contributor
I am having the same error
Attempted to read or write protected memory
ArcObjects addin dockable window
I am changing mxdoc.Pagelayout = pPageLayout at run time
the line goes fine till add the "pPagelayout.replaceMaps(mxdoc.Maps)"
at this moment the demon starts to play and after a little time of exercising the application and toggling between different layouts i got the error.
reading archived forums it sounds an old issue between esri and .net

0 Kudos
Regular Contributor III
Access Violation is a very generic error which simply indicates that the code is referencing memory which the OS has not made available to the process.  Often times, it is due to a null pointer dereference which can be seen by looking at the exception details.  The problem is whose fault is it?  If are writing C++ code then it could be your problem.  If you are just writing pure .NET code (no P\Invokes) then it is hard to imagine that the problem is yours.

Your best shot is if you are able to consistently reproduce the problem.  If you can then file an incident with ESRI support.
0 Kudos