Groups | Blog | Home
all groups > dotnet drawing api > april 2006 >

dotnet drawing api : AccessViolationException


Nat
4/28/2006 12:40:07 AM
I sometimes got some AccessViolationException from System.Drawing.dll. It
doesn't happen everytime but it happens like once a day. Is it a known issue
in .NET 2.0? I've never got this kind of exception in .NET 1.1 (even NullReferenceException)

System.AccessViolationException: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
at System.Drawing.SafeNativeMethods.Gdip.GdipDrawImagePointsRectI(HandleRef
graphics, HandleRef image, HandleRef points, Int32 count, Int32 srcx, Int32
srcy, Int32 srcwidth, Int32 srcheight, Int32 srcunit, HandleRef imageAttributes,
DrawImageAbort callback, HandleRef callbackdata)
at System.Drawing.Graphics.DrawImage(Image image, Point[] destPoints,
Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort
callback, Int32 callbackData)
at System.Drawing.Graphics.DrawImage(Image image, Point[] destPoints,
Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)
at DevExpress.XtraBars.Painters.PaintHelper.DrawImageCore(Graphics g,
Image image, Int32 x, Int32 y, Int32 width, Int32 height, Rectangle srcRect,
ImageAttributes attr)
at DevExpress.XtraBars.Painters.PrimitivesPainter.DrawLinkImage(BarLinkPaintArgs
e, Rectangle r, ImageAttributes attr, Image image, BarLinkState state)
at DevExpress.XtraBars.Painters.BarLinkPainter.DrawLinkImageCore(BarLinkPaintArgs
e, Rectangle r, BarLinkState state, ImageAttributes attr)
at DevExpress.XtraBars.Painters.BarLinkPainter.DrawLinkNormalGlyph(BarLinkPaintArgs
e, Boolean lighter)
at DevExpress.XtraBars.Painters.BarLinkPainter.DrawLinkNormal(BarLinkPaintArgs
e)
at DevExpress.XtraBars.Painters.BarLinkPainter.DrawLinkHorizontal(BarLinkPaintArgs
e)
at DevExpress.XtraBars.Painters.BarLinkPainter.DrawLink(BarLinkPaintArgs
e)
at DevExpress.XtraBars.Painters.BarLinkPainter.Draw(GraphicsInfoArgs e,
CustomViewInfo info, Object sourceInfo)
at DevExpress.XtraBars.Painters.BarPainter.DrawLink(GraphicsInfoArgs e,
BarLinkViewInfo item)
at DevExpress.XtraBars.Painters.BarPainter.Draw(GraphicsInfoArgs e, CustomViewInfo
info, Object sourceInfo)
at DevExpress.XtraBars.Controls.CustomControl.DirectDraw(PaintEventArgs e)
at DevExpress.XtraBars.Controls.CustomControl.OnPaint(PaintEventArgs e)
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 DevExpress.XtraBars.Controls.DockedBarControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)





System.AccessViolationException: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateImageAttributes(IntPtr&
imageattr)
at System.Drawing.Imaging.ImageAttributes..ctor()
at System.Windows.Forms.ControlPaint.DrawImageDisabled(Graphics graphics,
Image image, Rectangle imageBounds, Color background, Boolean unscaledImage)
at System.Windows.Forms.ButtonInternal.ButtonBaseAdapter.DrawImageCore(Graphics
graphics, Image image, Rectangle imageBounds, Point imageStart, LayoutData
layout)
at System.Windows.Forms.ButtonInternal.ButtonBaseAdapter.DrawImage(Graphics
graphics, LayoutData layout)
at System.Windows.Forms.ButtonInternal.ButtonStandardAdapter.PaintWorker(PaintEventArgs
e, Boolean up, CheckState state)
at System.Windows.Forms.ButtonInternal.ButtonStandardAdapter.PaintUp(PaintEventArgs
e, CheckState state)
at System.Windows.Forms.ButtonInternal.ButtonBaseAdapter.Paint(PaintEventArgs
pevent)
at System.Windows.Forms.ButtonBase.OnPaint(PaintEventArgs pevent)
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.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.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.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)



System.AccessViolationException: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
at System.Drawing.SafeNativeMethods.Gdip.GdipFillRectangleI(HandleRef
graphics, HandleRef brush, Int32 x, Int32 y, Int32 width, Int32 height)
at System.Drawing.Graphics.FillRectangle(Brush brush, Int32 x, Int32 y,
Int32 width, Int32 height)
at System.Drawing.Graphics.FillRectangle(Brush brush, Rectangle rect)
at DevExpress.Utils.Win.Shadow.OnPaint(PaintEventArgs e)
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.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at DevExpress.Utils.Win.TopFormBase.WndProc(Message& m)
at DevExpress.Utils.Win.Shadow.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.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

scrapperchick NO[at]SPAM gmail.com
4/28/2006 9:26:03 AM
I am having a very similair issue, did you get an answer or discover a
solution?

Thanks.
Samantha.

[quoted text, click to view]
Nat
5/2/2006 1:20:40 AM
Hello scrapperchick@gmail.com,

Did you use Application.EnableVisualStyles(). Now i'm having doubt that it
might be the cause of the issue.

Nat

[quoted text, click to view]

scrapperchick NO[at]SPAM gmail.com
5/2/2006 9:52:32 AM
I am not using Application.EnableVisualStyles(). I am using a
BindingSource to bind my data and a very simple datagridview, i'm still
perplexed and have not gotten much further toward a solution.
Developer Express Support
5/3/2006 1:17:19 AM
Hi All,

If you are experiencing any problems connected to DevExpress controls,
please feel free to contact our support at Support@DevExpress.com.
When contacting us, please specify the version of the products you are
using and if possible, please supply us with a test project for easy
problem recreation.

Thanks,
Max

Developer Express Support
Nat
5/3/2006 11:13:28 AM
Hello scrapperchick@gmail.com,

Are you using multithreading programming i.e. updating BindingSource from
the thread which is not the UI thread? If so, it might cause some problem.

Nat

[quoted text, click to view]

mike
5/24/2006 7:41:06 AM
AddThis Social Bookmark Button