.NET Framework Bookmark and Share   
 index > 64-Bit .NET Framework Development > System.AccessViolationException?
 

System.AccessViolationException?

So I'm in the process of getting an application that works on our 32-bit XP machines to work on our new 64-bit Vista machine. The application is mostly written in C#, except for one part of it that is a COM dll. At first when we tried to run the app on the new machine, we got the standard bad image format exceptions because we were trying to call the 32 bit dll from a 64 bit application. To fix this we are using component services to run a wrapper for the dll.

This new setup works, but only sometimes. The application works properly when compiled for 32-bit. However, when the application is compiled for 64-bit, it gives a System.AccessViolationException when I try to run it. The stack trace says it was having problems in System.StubHelpers.ValueClassMarshaler.ConvertToManaged(IntPtr dst, IntPtr src, IntPtr pMT) and System.StubHelpers.ValueClassMarshaler.ClearNative(IntPtr dst, IntPtr pMT). I'm fairly sure the 64-bit version of the application is able to talk to the dll, though because I can get normal error responses from it when I give it bad input.

I've spent quite a lot of time looking for this on google, and most of the advice I get is "try compiling for 32-bit". Which doesn't really help, since my application would really benefit from having the extra memory 64-bit allows. I can't find anything whatsoever on the methods that are throwing the exception. And most of the advice I see on COM interop is for people who can't get it to work at all, rather than people who can get it to work in 32-bit, but not 64-bit. So, any recommendations on what to do about my problem, or where to look for a solution?
Robert M Ricketts
I am also getting the same result when i try to call a c++ dll from my .net code Please help.......
Rohit Saha

You can use google to search for other answers

Custom Search

More Threads

• How to differentiate code by platform?
• Datasets are larger in 64-bit Framework
• InteropServices.COMException (0x80040154)
• x64 COM registering error
• NT Framework, .dll
• c++/cli for anycpu
• ASP.NET 2.0 app reports Configuration Error: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
• owc11 download to excel functionality
• 64Bit Compiler?
• Cannot Find Server