By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,319 Members | 2,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,319 IT Pros & Developers. It's quick & easy.

VB2008 Express Edition Problem, "Attempted to read or write protected memory." when using SaveFile dialog

P: n/a
Windows XP SP3

My application is set to open a SaveFile dialog when an exit is
requested. When I click the app's close button, the save dialog
opens, but when I click to change the folder, the exception occurs
pointing to FileSaveDialog1.ShowDialog(). The exception also
indicates some problem with system.drawing.dll.

The exception text is:
"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."

I've also included the exception details below.

In trying to resolve this, I first removed and reinstalled VB2008
Express Edition. After that failed to fix it, I reinstalled Windows
XP and installed VB2008 ExpEd yet again with the same results.

I have other apps that use the save dialog that work fine.

Also, when I copy the project structure to another WinXP SP3 machine
with VB2008 ExpEd installed, the application works perfectly. Both
machines have all of the updates for Windows and VS2005 as of today.

This exception also occurs when I use the application's file save
button as well as the load file button.

Can anyone please help me to determine what is wrong?

Thanks in advance,

-- ScottG

Exception Details:

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.GdipDrawLine I(HandleRef
graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2) at
System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32
x2, Int32 y2) at
System.Windows.Forms.GroupBox.DrawGroupBox(PaintEv entArgs e) at
System.Windows.Forms.GroupBox.OnPaint(PaintEventAr gs e) at
System.Windows.Forms.Control.PaintWithErrorHandlin g(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.GroupBox.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.GetSaveFi leName(OPENFILENAME_I
ofn) at
System.Windows.Forms.SaveFileDialog.RunFileDialog( OPENFILENAME_I ofn)
at System.Windows.Forms.FileDialog.RunDialogOld(IntPt r hWndOwner)
at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner) at
System.Windows.Forms.CommonDialog.ShowDialog(IWin3 2Window owner) at
System.Windows.Forms.CommonDialog.ShowDialog() at
GateManPoly_Patch_Editor.Form1.GateMan_I_Patch_Edi tor_FormClosing(Object
sender, FormClosingEventArgs e) in
E:\VS2008\VB\Projects\Synth\GateManPoly_Patch_Edit or\GateManPoly_Patch_Editor\Form1.vb:line
886 at System.Windows.Forms.Form.OnFormClosing(FormClosin gEventArgs
e) at System.Windows.Forms.Form.WmClose(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mess age& m) at
System.Windows.Forms.Form.WmSysCommand(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mess age& m) at
System.Windows.Forms.Form.WmNcButtonDown(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.Run(ApplicationCo ntext context) at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[]
commandLine) at
GateManPoly_Patch_Editor.My.MyApplication.Main(Str ing[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args) at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()
InnerException:

Jun 27 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
I'm curious, does this have anything to do with the .NET Framework ver
1.1?
On Sat, 10 May 2008 17:40:35 GMT, no*****@gte.net (Scott Gravenhorst)
wrote:
>Windows XP SP3

My application is set to open a SaveFile dialog when an exit is
requested. When I click the app's close button, the save dialog
opens, but when I click to change the folder, the exception occurs
pointing to FileSaveDialog1.ShowDialog(). The exception also
indicates some problem with system.drawing.dll.

The exception text is:
"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."

I've also included the exception details below.

In trying to resolve this, I first removed and reinstalled VB2008
Express Edition. After that failed to fix it, I reinstalled Windows
XP and installed VB2008 ExpEd yet again with the same results.

I have other apps that use the save dialog that work fine.

Also, when I copy the project structure to another WinXP SP3 machine
with VB2008 ExpEd installed, the application works perfectly. Both
machines have all of the updates for Windows and VS2005 as of today.

This exception also occurs when I use the application's file save
button as well as the load file button.

Can anyone please help me to determine what is wrong?

Thanks in advance,

-- ScottG

Exception Details:

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.GdipDrawLin eI(HandleRef
graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2) at
System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32
x2, Int32 y2) at
System.Windows.Forms.GroupBox.DrawGroupBox(PaintE ventArgs e) at
System.Windows.Forms.GroupBox.OnPaint(PaintEventA rgs e) at
System.Windows.Forms.Control.PaintWithErrorHandli ng(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.GroupBox.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.GetSaveF ileName(OPENFILENAME_I
ofn) at
System.Windows.Forms.SaveFileDialog.RunFileDialog (OPENFILENAME_I ofn)
at System.Windows.Forms.FileDialog.RunDialogOld(IntPt r hWndOwner)
at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner) at
System.Windows.Forms.CommonDialog.ShowDialog(IWin 32Window owner) at
System.Windows.Forms.CommonDialog.ShowDialog() at
GateManPoly_Patch_Editor.Form1.GateMan_I_Patch_Ed itor_FormClosing(Object
sender, FormClosingEventArgs e) in
E:\VS2008\VB\Projects\Synth\GateManPoly_Patch_Edi tor\GateManPoly_Patch_Editor\Form1.vb:line
886 at System.Windows.Forms.Form.OnFormClosing(FormClosin gEventArgs
e) at System.Windows.Forms.Form.WmClose(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWind owProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Mess age& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Me ssage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mes sage& m) at
System.Windows.Forms.Form.WmSysCommand(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWind owProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Mess age& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Me ssage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mes sage& m) at
System.Windows.Forms.Form.WmNcButtonDown(Messag e& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.Dispatch MessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager .System.Windows.Forms.UnsafeNativeMethods.IMsoComp onentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.Ru nMessageLoopInner(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.Ru nMessageLoop(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.Run(ApplicationC ontext context) at
Microsoft.VisualBasic.ApplicationServices.Windows FormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.Windows FormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.Windows FormsApplicationBase.Run(String[]
commandLine) at
GateManPoly_Patch_Editor.My.MyApplication.Main(St ring[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args) at
Microsoft.VisualStudio.HostingProcess.HostProc.Ru nUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()
InnerException:
Jun 27 '08 #2

P: n/a
In your two messages you seem to have included VS 2005, VB 2008 Express, and
..Net 1.1. VS 2005 only targets 2.0 (AFAIK), and 2008 can target 2.0 and
higher. I don't think 2008 can target 1.1, but I might be wrong.

From the error message, is it some how possible in your code that there is a
thread still running that tries to interact with your UI while the save
dialog is displayed?

"Scott Gravenhorst" wrote:
I'm curious, does this have anything to do with the .NET Framework ver
1.1?
On Sat, 10 May 2008 17:40:35 GMT, no*****@gte.net (Scott Gravenhorst)
wrote:
Windows XP SP3

My application is set to open a SaveFile dialog when an exit is
requested. When I click the app's close button, the save dialog
opens, but when I click to change the folder, the exception occurs
pointing to FileSaveDialog1.ShowDialog(). The exception also
indicates some problem with system.drawing.dll.

The exception text is:
"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."

I've also included the exception details below.

In trying to resolve this, I first removed and reinstalled VB2008
Express Edition. After that failed to fix it, I reinstalled Windows
XP and installed VB2008 ExpEd yet again with the same results.

I have other apps that use the save dialog that work fine.

Also, when I copy the project structure to another WinXP SP3 machine
with VB2008 ExpEd installed, the application works perfectly. Both
machines have all of the updates for Windows and VS2005 as of today.

This exception also occurs when I use the application's file save
button as well as the load file button.

Can anyone please help me to determine what is wrong?

Thanks in advance,

-- ScottG

Exception Details:

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.GdipDrawLine I(HandleRef
graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2) at
System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32
x2, Int32 y2) at
System.Windows.Forms.GroupBox.DrawGroupBox(PaintEv entArgs e) at
System.Windows.Forms.GroupBox.OnPaint(PaintEventAr gs e) at
System.Windows.Forms.Control.PaintWithErrorHandlin g(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.GroupBox.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.GetSaveFi leName(OPENFILENAME_I
ofn) at
System.Windows.Forms.SaveFileDialog.RunFileDialog( OPENFILENAME_I ofn)
at System.Windows.Forms.FileDialog.RunDialogOld(IntPt r hWndOwner)
at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner) at
System.Windows.Forms.CommonDialog.ShowDialog(IWin3 2Window owner) at
System.Windows.Forms.CommonDialog.ShowDialog() at
GateManPoly_Patch_Editor.Form1.GateMan_I_Patch_Edi tor_FormClosing(Object
sender, FormClosingEventArgs e) in
E:\VS2008\VB\Projects\Synth\GateManPoly_Patch_Edit or\GateManPoly_Patch_Editor\Form1.vb:line
886 at System.Windows.Forms.Form.OnFormClosing(FormClosin gEventArgs
e) at System.Windows.Forms.Form.WmClose(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mess age& m) at
System.Windows.Forms.Form.WmSysCommand(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mess age& m) at
System.Windows.Forms.Form.WmNcButtonDown(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.Run(ApplicationCo ntext context) at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[]
commandLine) at
GateManPoly_Patch_Editor.My.MyApplication.Main(Str ing[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args) at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()
InnerException:

Jun 27 '08 #3

P: n/a
On Sat, 10 May 2008 16:16:01 -0700, Family Tree Mike
<Fa************@discussions.microsoft.comwrote:
>In your two messages you seem to have included VS 2005, VB 2008 Express, and
.Net 1.1. VS 2005 only targets 2.0 (AFAIK), and 2008 can target 2.0 and
higher. I don't think 2008 can target 1.1, but I might be wrong.

From the error message, is it some how possible in your code that there is a
thread still running that tries to interact with your UI while the save
dialog is displayed?
No, It's a very simple application. And it runs fine on another XP
box I have.

However, riddle me this: I suspected .NET Framework as a source
because it was something that I had installed using an ATI video
driver CD.

When I tried to remove all of the .NET framework software, the
uninstaller encounters a problem and can't uninstall the hotfix for
1.1 nor .NET framework 1.1.

That made me suspiscious, so using another drive, I reinstalled XP but
I did NOT install the .NET framework ver 1.1. I then installed VB2008
express and the program is now working correctly on both systems.

The other system, the one that never failed, has a different video
card so I didn't need to install anything from that CD. When I was
installing the framework from that CD it was because I assumed the ATI
process needed it for something. Now I know better. Other than what
I just wrote, I don't have proof that it was .NET Framework 1.1
(possibly a corrupt copy), but in my mind, the evidence certainly
points to it.

In any case, it seems to be working now.

Thank you for your response.

-- ScottG

>"Scott Gravenhorst" wrote:
>I'm curious, does this have anything to do with the .NET Framework ver
1.1?
On Sat, 10 May 2008 17:40:35 GMT, no*****@gte.net (Scott Gravenhorst)
wrote:
>Windows XP SP3

My application is set to open a SaveFile dialog when an exit is
requested. When I click the app's close button, the save dialog
opens, but when I click to change the folder, the exception occurs
pointing to FileSaveDialog1.ShowDialog(). The exception also
indicates some problem with system.drawing.dll.

The exception text is:
"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."

I've also included the exception details below.

In trying to resolve this, I first removed and reinstalled VB2008
Express Edition. After that failed to fix it, I reinstalled Windows
XP and installed VB2008 ExpEd yet again with the same results.

I have other apps that use the save dialog that work fine.

Also, when I copy the project structure to another WinXP SP3 machine
with VB2008 ExpEd installed, the application works perfectly. Both
machines have all of the updates for Windows and VS2005 as of today.

This exception also occurs when I use the application's file save
button as well as the load file button.

Can anyone please help me to determine what is wrong?

Thanks in advance,

-- ScottG

Exception Details:

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.GdipDrawLin eI(HandleRef
graphics, HandleRef pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2) at
System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32
x2, Int32 y2) at
System.Windows.Forms.GroupBox.DrawGroupBox(PaintE ventArgs e) at
System.Windows.Forms.GroupBox.OnPaint(PaintEventA rgs e) at
System.Windows.Forms.Control.PaintWithErrorHandli ng(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.GroupBox.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.GetSaveF ileName(OPENFILENAME_I
ofn) at
System.Windows.Forms.SaveFileDialog.RunFileDialog (OPENFILENAME_I ofn)
at System.Windows.Forms.FileDialog.RunDialogOld(IntPt r hWndOwner)
at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner) at
System.Windows.Forms.CommonDialog.ShowDialog(IWin 32Window owner) at
System.Windows.Forms.CommonDialog.ShowDialog() at
GateManPoly_Patch_Editor.Form1.GateMan_I_Patch_Ed itor_FormClosing(Object
sender, FormClosingEventArgs e) in
E:\VS2008\VB\Projects\Synth\GateManPoly_Patch_Edi tor\GateManPoly_Patch_Editor\Form1.vb:line
886 at System.Windows.Forms.Form.OnFormClosing(FormClosin gEventArgs
e) at System.Windows.Forms.Form.WmClose(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWind owProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Mess age& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Me ssage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mes sage& m) at
System.Windows.Forms.Form.WmSysCommand(Message& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.CallWind owProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at
System.Windows.Forms.NativeWindow.DefWndProc(Mess age& m) at
System.Windows.Forms.Form.DefWndProc(Message& m) at
System.Windows.Forms.Control.WndProc(Message& m) at
System.Windows.Forms.ScrollableControl.WndProc(Me ssage& m) at
System.Windows.Forms.ContainerControl.WndProc(Mes sage& m) at
System.Windows.Forms.Form.WmNcButtonDown(Messag e& m) at
System.Windows.Forms.Form.WndProc(Message& m) at
System.Windows.Forms.Control.ControlNativeWindow. OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.Dispatch MessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager .System.Windows.Forms.UnsafeNativeMethods.IMsoComp onentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.Ru nMessageLoopInner(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.Ru nMessageLoop(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.Run(ApplicationC ontext context) at
Microsoft.VisualBasic.ApplicationServices.Windows FormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.Windows FormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.Windows FormsApplicationBase.Run(String[]
commandLine) at
GateManPoly_Patch_Editor.My.MyApplication.Main(St ring[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args) at
Microsoft.VisualStudio.HostingProcess.HostProc.Ru nUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()
InnerException:

Jun 27 '08 #4

P: n/a
In your two messages you seem to have included VS 2005, VB 2008 Express,
and
.Net 1.1. VS 2005 only targets 2.0 (AFAIK), and 2008 can target 2.0 and
higher. I don't think 2008 can target 1.1, but I might be wrong.
You are right

Cor

Jun 27 '08 #5

P: n/a
On Sun, 11 May 2008 09:00:05 +0200, "Cor Ligthert[MVP]"
<no************@planet.nlwrote:
>In your two messages you seem to have included VS 2005, VB 2008 Express,
and
.Net 1.1. VS 2005 only targets 2.0 (AFAIK), and 2008 can target 2.0 and
higher. I don't think 2008 can target 1.1, but I might be wrong.
You are right

Cor
Cor,

That may be the case, and I believe you. However, the problem is back
again, on this particular machine. It now seems to be somewhat
intermittent.

The same project compiles and executes correctly on another machine -
so this is not a problem with another thread interfering.

Oddly enough, on the same machine that fails, I can run other VB2008
Express Edition apps that do not have this problem - and again, the
project that has the problem works correctly on at least one other XP
SP3 machine.

Any clues? i.e., what should I do to get more information about this
failure?

Are there any diagnostic programs available to help me determine the
cause of this?
---------- description of the program:

This program collects information from various controls, trackbars,
and some dropdowns. The information is then sent out a serial port to
another device. That's all it does. There's no need for any advanced
threading, it's a very simple program. I can post the code if that's
going to help.


Jun 27 '08 #6

P: n/a
More information about this:

If I simply build the project and exit VB2008 and then double click
the executable created using Explorer, the exception does not occur.

-- ScottG

Jun 27 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.