I randomly get an AccessViolationException in the Graphics3DGdiPlus class in the method ClipRectangle when SetClipRegion(new Region(CorrectRectangle(r))) is called.
Here is the exception:
Would you have any idea why this is happening? I am running a C# app on XP.System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="System.Drawing"
StackTrace:
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateRegionRectI(GPRECT& gprect, IntPtr& region)
at System.Drawing.Region..ctor(Rectangle rect)
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.ClipRectangle(Rectangle r) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\Drawing\CanvasGDIplus.cs:line 818
at Steema.TeeChart.Drawing.Graphics3D.ClipRectangle(Int32 left, Int32 top, Int32 right, Int32 bottom) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\Drawing\Canvas.cs:line 7289
at Steema.TeeChart.Drawing.Graphics3D.ClipCube(Rectangle rect, Int32 minZ, Int32 maxZ) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\Drawing\Canvas.cs:line 7501
at Steema.TeeChart.Styles.Series.ClipRegionCreate(Boolean& ActiveRegion) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\Series.cs:line 3129
at Steema.TeeChart.Styles.Series.DrawSeries() in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\Series.cs:line 3307
at Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\Chart.cs:line 942
at Steema.TeeChart.Chart.InternalDraw(Graphics g) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\Chart.cs:line 807
at Steema.TeeChart.TChart.Draw(Graphics g) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\TeeChart.cs:line 566
at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe) in C:\Projects\Projects\ITRADEFX\TeeChart for .NET v3 Full Source Code\Sources\TeeChart\TeeChart.cs:line 606
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ITradeFx.Windows.Program.Main() in C:\Projects\Projects\ITRADEFX\ITradeFx Chart Control\ControlsTestApp\ControlsTestApp\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Thanks,
Kevin