AccessViolationException on ActiveView.Output

3430
1
10-30-2014 08:23 AM
BjørnarSundsbø
Occasional Contributor

Hi,

We have a service that runs as a WCF REST service, and is responsible for exporting map images based on the requested extent. For this we use the MapDocument class, and use ActiveView.Output to perform the export operation. ActiveView.Activate(hwnd) receives a pointer to GetDesktopWindow after the document is opened.

One of our customers randomly experience an AccessViolationException, where the last part of the stack trace is ESRI.ArcGIS.Carto.IActiveView.Output(Int32, Int32, ESRI.ArcGIS.esriSystem.tagRECT ByRef, ESRI.ArcGIS.Geometry.IEnvelope, ESRI.ArcGIS.esriSystem.ITrackCancel). We pass in a handle to a bitmap for the output operation. There is one occurence where this happens at ESRI.ArcGIS.Carto.IFeatureLayer.get_TipText(Double, Double, Double).

The customer is not able to reproduce this reliably, and we are not able to reproduce locally. We have also gone through logs from other customers, and have found no trend on this kind of error at other locations, except for sporadic occurences with months apart. With the particular client in question, they experience it daily.

I'm wondering if it could be in some way related to the graphics card. The graphics card has not replaced. All computers have the same card and drivers. NVIDIA NVS 300, with driver version 9.18.13.593. Thought this has "only" been going on for two months, and based on Windows Eventviewer, there are no occurences of this before that. No changes have been made to the graphics card. The service is compiled as x86, using C# and .NET Framework 4.0.

I don't know to what extent the graphics card and/or drivers are involved in the export process, and to what degree it is used by GDI+, which I presume is used behind the scenes. Are there alternatives to activating the ActiveView in a background process, rather than GetDesktopWindow?

I came across a thread related to AccessViolationException that referenced the way memory is optimized in release, that might affect this kind of thing? .net - Randomly occuring AccessViolationException in GDI+ - Stack Overflow Could that be in play here?

I know this is a rather tricky exception to investigate, but I hope some help could be provided by ESRI, or others who have solved this kind of issue.

0 Kudos
1 Reply
BjørnarSundsbø
Occasional Contributor

I tried compiling the service without optimization, as suggested by the StackOverflow post, but had no luck when we tested it at the customer.

0 Kudos