Click here to Skip to main content
15,740,731 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Please help me to fix the below issue in Windows 7 64 client.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Windows.Forms.FileDialogNative.IFileDialog.Show(IntPtr parent)
   at System.Windows.Forms.FileDialog.RunDialogVista(IntPtr hWndOwner)
   at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner)
   at iSAP2.GroundMaster.btnBrowse_Click(Object sender, EventArgs e)
Updated 13-May-11 1:15am
OriginalGriff 13-May-11 6:37am    
It's obvious: line 117 of your .CS file is wrong.

How are we supposed to answer that? Telepathy? Hack into your PC and examine your hard drive contents?
Perhaps, a small amount of code might just give us a clue as to what your are doing that is wrong. Maybe a whole method. The btnBrowse click event handler would be a start...

One likely reason could be mixing 32-bit and 64-bit libraries. It often compiles but crashed during run-time. Please check up. The target architecture is defined by entry assembly. If this is "Any CPU" — by platforms default, in your case either Itanium (IE-64) or x86-64. Try to experiment using explicit target in all assemblies, check up native libraries it you use them.

Share this answer
It isn't very hard to diagonise any issue if you have exact error message with you.
You should start by searching Google/Bing for the error message. Here is the search link[^]. You will find a comprehensive discussion at many sites.

BTW the error message is pretty self explanatory. :thumbsup:
Share this answer
Since you are using a file dialog, it could just be that you are trying to access something that is already open in another program (and probably has been modified) like a word file.

Unlikely, is worth a try to just make sure things are in order.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900