Attempted to read or write protected memory. Exception in releasebuild, instantiating unmanaged cla

B

Bruce

I am getting the following exception in the release build of my assembly.

{"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."} System.Exception
{System.AccessViolationException}

I do not have any problems in debug. The problem occurs while
instantiating an unmanaged class.

Any idea what is causing the problem? Why would I get the problem in
release but not debug?


I have included the wrapper managed class below. The unmanaged class
GarXface4::UsbDeviceNameList enumerates USB devices using functions
found in Setupapi. The class works fine when called with unmanaged code.


public ref class UsbNames
{
public:
UsbNames()
{
m_pLst = new GarXface4::UsbDeviceNameList();
}

~UsbNames()
{

delete m_pLst;
}

private:

GarXface4::UsbDeviceNameList *m_pLst;
};
 
B

Bruce

Never mind, I got this working. Just needed to recompile the unmanaged
class's static lib.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top