Windows Develop Bookmark and Share   
 index > Windows Forms General > System.AccessViolationException
 

System.AccessViolationException

My winform app caught and logged this error. I've googled and not seen anything very definitive.
Could someone shed some light on this?

2009-10-03 14:58:11,572 [1] ERROR WebMonitor2.Program - System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   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 WebMonitor2.Program.Main()
cyrix86  Monday, October 05, 2009 2:39 PM
When did your program start doing that?
Wyck  Monday, October 05, 2009 2:52 PM

According to the logs, my app had been running for almost 24 hrs without incident before the error happened.

cyrix86  Monday, October 05, 2009 3:20 PM
Could this exception happen from the application running out of memory? For example, having too many function calls on the stack?
cyrix86  Monday, October 05, 2009 5:55 PM
No, I mean, what did you change in your code to make it do that?  Did older versions of your code ever run correctly without crashing like that before?  Or was your first attempt at the code bogus?  Because it looks like you've got some bogus message passing stuff happening.

I don't think it could be endless recursion (stack overflow) because your stack looks generally good and short. 

I can't figure it out from these clues alone.  More details might help.
Wyck  Monday, October 05, 2009 8:34 PM
This was the first time that the code had been running that long. The had run previous for only about 15 hrs at the most. The only reason I mentioned the function calls is because I'm repeatedly calling the webbrowser.navigate() from the webbrowser.DocumentCompleted event. The wb.Navigate() breaks out of whatever function it is called from and so I didn't know if doing this alot would have lots of method calls on the stack that were never returned from.
cyrix86  Monday, October 05, 2009 8:50 PM

You can use google to search for other answers

Custom Search

More Threads

• String Editing
• How do I create a backshadow of a line of text
• ShotDown Windows
• Clear autoselected first row in DataGridView
• how to hide checkbox in gridview according to condition
• Form opacity and custom panel paint problem
• Printform problem
• Add FlowLayoutPanel to listbox
• Enable and Disable a Button
• ListBox.Remove