ERROR

ArcGIS Engine Application crashes when ArcObjects makes calls to GDIplus

Last Published: April 25, 2020

Error Message

At version 10, COM-based applications using ArcGIS Engine Controls may abort with an unhandled exception error message dialog box displaying similar to the following message:

"Unhandled exception as 0x7x91b21a (ntdll.dll) in
ArcGIS_Engine_10_PageLayout_Issues.exe:0xC0000005: Access
violation writing location 0x00000010."

Cause

This crash may be caused by an ArcGIS component making use of GDI+ before GDI+ has been properly initialized. This problem is being investigated further by Esri. In the meantime, use one of the workarounds provided.

Solution or Workaround

There are two workarounds for this error.

Workaround 1:

It is necessary to call GdiplusStartup before creating any GDI+ objects, and it is necessary to delete all of the GDI+ objects (or have them go out of scope) before calling GdiplusShutdown. Add the following C++ code to the application:

Include:

Code:
Windows.h
Gdiplus.h


To initialize the application, for example in the X() function:

Code:
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);


To uninitialize:

Code:
Gdiplus::GdiplusShutdown(gdiplusToken);



Workaround 2:

Add the ToolbarControl to a dialog box, as this initiates GDI+.

    Article ID:000011070

    Software:
    • ArcGIS Engine

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Discover more on this topic