tags:

views:

336

answers:

1

im having a hard time correcting this bug, the app is tested on 4 diffrent machines and works fine on 3 of them but one vista PC gives this error when trying to open a page trough WebBrower1

anyhelp resolving this wold be very helpful to me.

System.AccessViolationException occurred
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="System.Windows.Forms"
StackTrace:
   ved System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   ved System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   ved System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   ved System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   ved System.Windows.Forms.Application.Run(Form mainForm)
   ved Dispatcher_Tool.Program.Main() i C:\Users\norah\Downloads\Kopi av Dispacher Tool_utvikling\Dispacher Tool\Program.cs:linje 18
InnerException:

Update:

i have found out that that my code is not the issue, i tryed creating a test new form with only a webBrowser and the direct URL for opening the Web page.

the web page starts, then the script on the web page opens a secondary page that seems to try to redirect my webBrowser1 to the page the script tells it too.

if i set webBrowser1.AllowNavigation = False i dont get the Crash so the error seems to happen when teh script trys to update in webBrowser1, anyone got a clue how to work around this?

+1  A: 

It was a Vista Issue, what happens was that my App opens a web page that runs a java applet that opens a external IE webpage that runs a ActiveX app/script. When the ActiveX script tryes to update back in to the memory of the C# app the DEP "Data Execution Prevention" in Vista flags this operation as Hostile/virus and ends the program with the System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

My fix for this was to turn of DEP in Vista with this line "bcdedit.exe /set {current} nx AlwaysOff"

and reboot the machine.

Darkmage