.NET Framework Developer Center >
.NET Development Forums
>
.NET Base Class Library
>
A generic error occurred in GDI+
A generic error occurred in GDI+
- Using .NET 1.1
The following API Graphics::DrawLine Method (Pen, Point, Point) throws a System.Runtime.InteropServices.ExternalException with message "A generic error occurred in GDI+".
This occurs inside a loop and it happens on the 6th iteration of the loop. The input parameter is point1.x=422 and point1.y=5103, point2.x=442 and point2.y = 5103.
This is the first time this error has occured in this application. The application had been running for 3 days when it happend (if that matters).
The process in question is using roughly 800 handles, so I do not think that is the problem.
I assume a problem occurs within the GDI+ but how I am unsure howto continue debugging this problem?
I have included a call stack and exception output from windbg;
0012ee64 792f0d05 mscorwks!JIT_Throw+0x4d, calling mscorwks!RaiseTheException
0012eea4 792f0cce mscorwks!JIT_Throw+0x16, calling mscorwks!LazyMachState::captureState
0012eed0 7b518150 (MethodDesc 0x7b59de60 +0x90 System.Drawing.Graphics.CheckErrorStatus), calling mscorwks!JIT_Throw
0012eee8 7b5904b8 (stub for System.Drawing.SafeNativeMethods.GetLastError), calling 0732a0f8
0012eef0 7b518117 (MethodDesc 0x7b59de60 +0x57 System.Drawing.Graphics.CheckErrorStatus), calling ntdll!RtlGetLastWin32Error
0012eef4 7b594810 (stub for System.Drawing.SafeNativeMethods.GdipDrawLineI), calling 01fc286c
0012eef8 7b51960d (MethodDesc 0x7b59e9e0 +0x7d System.Drawing.Graphics.DrawLine), calling 7b59480b (MethodDesc 0x7b594810 System.Drawing.SafeNativeMethods.GdipDrawLineI)
0012ef10 7b519617 (MethodDesc 0x7b59e9e0 +0x87 System.Drawing.Graphics.DrawLine), calling 7b59de5b (MethodDesc 0x7b59de60 System.Drawing.Graphics.CheckErrorStatus)
0012ef3c 7b537576 (MethodDesc 0x7b59e9f0 +0x16 System.Drawing.Graphics.DrawLine), calling 7b59e9db (MethodDesc 0x7b59e9e0 System.Drawing.Graphics.DrawLine)
0012ef50 0ef1d63c (MethodDesc 0x1f55650 +0x6d4 MS.View.ViewAxis.DrawVerticalAxisTicks), calling 7b59e9eb (MethodDesc 0x7b59e9f0 System.Drawing.Graphics.DrawLine)
0012ef8c 4ec9e417 GdiPlus!GdipDrawLine+0xc1, calling GdiPlus!GpGraphics::DrawLine
0012f0b8 0ef1b2f5 (MethodDesc 0x1f563d8 +0x1cd MS.View.ViewGraph.Draw), calling (MethodDesc 0x1f55650 MS.View.ViewAxis.DrawVerticalAxisTicks)
0012f10c 09b861d1 (MethodDesc 0x1f5c100 +0x19 MS.View.ViewCurve.set_CurveColor), calling mscorwks!JIT_UP_ByRefWriteBarrier
0012f11c 0ef1b074 (MethodDesc 0x1f57050 +0x184 MS.View.Graph.Draw), calling (MethodDesc 0x1f563d8 MS.View.ViewGraph.Draw)
0012f18c 0ef19316 (MethodDesc 0xe29f0a8 +0x4c6 MS.View.View.Draw)
0:014> !dumpobj 07692190
Name: System.Runtime.InteropServices.ExternalException
MethodTable 0x79bc806c
EEClass 0x79bc80ec
Size 64(0x40) bytes
mdToken: 020002d3 (c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll)
FieldDesc*: 00000000
MT Field Offset Type Attr Value Name
79b947ac 400001d 4 CLASS instance 00000000 _className
79b947ac 400001e 8 CLASS instance 00000000 _exceptionMethod
79b947ac 400001f c CLASS instance 00000000 _exceptionMethodString
79b947ac 4000020 10 CLASS instance 076927d4 _message
79b947ac 4000021 14 CLASS instance 00000000 _innerException
79b947ac 4000022 18 CLASS instance 00000000 _helpURL
79b947ac 4000023 1c CLASS instance 07692828 _stackTrace
79b947ac 4000024 20 CLASS instance 00000000 _stackTraceString
79b947ac 4000025 24 CLASS instance 00000000 _remoteStackTraceString
79b947ac 4000026 2c System.Int32 instance 0 _remoteStackIndex
79b947ac 4000027 30 System.Int32 instance -2147467259 _HResult
79b947ac 4000028 28 CLASS instance 00000000 _source
79b947ac 4000029 34 System.Int32 instance 0 _xptrs
79b947ac 400002a 38 System.Int32 instance -532459699 _xcode
All Replies
- Just wanted to add some more information.
While researching this issue I have seen similar problems and they mostly refer to using bitmaps and metafile.
The graphical object in this situation is based on CDC and is created using MFC.
void View.Draw()
{
CDC* pDC = new CDC();
System::Drawing::Graphics* pGraphics = System::Drawing::Graphics::FromHdc(pDC.GetSafeHdc());
graph->Print(pGraphics);
}
The only property change to the pGraphics object is that TextRenderingHint is set to AntiAlias.


