473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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


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;
};
--
Bruce E. Stemplewski
GarXface OCX and C++ Class Library for the Garmin GPS
www.stempsoft.com
Dec 31 '06 #1
1 3217
Never mind, I got this working. Just needed to recompile the unmanaged
class's static lib.


--
Bruce E. Stemplewski
GarXface OCX and C++ Class Library for the Garmin GPS
www.stempsoft.com
Dec 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: hiralparikh | last post by:
Hi, I am using .NET 2.0 and trying to use a function from a native DLL file. Here is the syntax that I am using: definition: public static extern String getPwd(String strServerName, String...
2
by: Ilkka | last post by:
I have created an C++ application with Windows Forms, ADO and SQL server 2005. Now I need to change something and started debugging the code. Then suddenly I receive an error. "An unhandled...
10
by: spacehopper_man | last post by:
ok - C# contractor on first contract getting this bad boy: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I see this intermittantly...
2
by: Pieter | last post by:
Hi, Since 10 days (the first time was the 10th of november) I have some weird exception happening in an application here: All (except 1 of the total of 5) users had this error now 1 of 2 times...
2
by: adypoly | last post by:
Hi guys... I am having a typical problem in using one of the native dll in C# I'll explain what am trying to do, I've a dll written in C language which i am trying to include in my C# project,...
6
by: Sugandh Jain | last post by:
Hi, I am getting the error message Attempted to read or write protected memory. This is often an indication that other memory is corrupt. It was not coming until yet, for around 2 months. Now,...
1
by: Marc Bartsch | last post by:
Hi, My C# app throws the following exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. From...
6
by: Scott Gravenhorst | last post by:
Windows XP SP3 My application is set to open a SaveFile dialog when an exit is requested. When I click the app's close button, the save dialog opens, but when I click to change the folder, the...
3
by: sriram347 | last post by:
Hi I am a newbie to ASP.NET. I developed a web page (project type is web application) and I keep getting this error. B]Error message : "System.AccessViolation Exception attempted to read or...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.