.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.Net 2.0 errors with ADT2006

10 REPLIES 10
Reply
Message 1 of 11
jimmie_fulton
389 Views, 10 Replies

.Net 2.0 errors with ADT2006

I'm unable to read in a drawing file using .Net Framework 2.0. I must be missing something really simple. The following code works fine with VS2003, but AutoCAD crashes with a FATAL ERROR when using VS2005.

[CommandMethod("test")]
public static void test()
{
using (Database database = new Database(false, true))
{
database.ReadDwgFile(@"C:\tests\15.dwg", FileShare.Read, false, "");
}
}

Ummmm, should be simple, right? Should this be working right out of the box, or is there something I need to do? (BTW, I've recommented the Framework version in acad.exe.config to allow use of the framework that comes with VS2005.)

Thanks!
10 REPLIES 10
Message 2 of 11

Further info on this:
Catching the exception from this gives a message of
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I get this whether the method is static or not, and whether the CommandFlags.Session is set or not.

Anyone else using VS2005 with ADT2006?
Message 3 of 11
Anonymous
in reply to: jimmie_fulton

I got the same error, but no crash.

Changing the path to double backslashes fixed
the problem.

--
gl - Paul
wrote in message news:5109783@discussion.autodesk.com...
Further info on this:
Catching the exception from this gives a message of
"Attempted to read or write protected memory. This is often an indication
that other memory is corrupt."

I get this whether the method is static or not, and whether the
CommandFlags.Session is set or not.

Anyone else using VS2005 with ADT2006?
Message 4 of 11

I was getting the crash only because I wasn't catching the exception. Double back slashes? Weird. Seems that the exact same code that works with VS2003 should work with VS2005. I tried the double back slashed but that did not work, both with and without the preceding @. Are you using ADT, or a different product?

My suspicion is that there are ADT Managed parts compiled in .Net 1.1 that don't like being executed in conjunction with .Net 2.0 components.
Message 5 of 11
Anonymous
in reply to: jimmie_fulton

I'm using ADT06 also I just tried it does both
ways with no problem, although I did get the
error the first time I tried. Don't know what I
did to fix it.

Here is the class

--
gl - Paul
wrote in message news:5109873@discussion.autodesk.com...
I was getting the crash only because I wasn't catching the exception.
Double back slashes? Weird. Seems that the exact same code that works with
VS2003 should work with VS2005. I tried the double back slashed but that
did not work, both with and without the preceding @. Are you using ADT, or
a different product?

My suspicion is that there are ADT Managed parts compiled in .Net 1.1 that
don't like being executed in conjunction with .Net 2.0 components.
Message 6 of 11

I've figured out that this has to do with disabling Managed Debugging Assistants. If I turn off all MDA's using the registry, I get no error messages about running code in DllMain. But, then I get this error instead. If I leave all MDAs as default or turn them all on, I get a bunch of complaints about running code in DllMain, but then everything works fine after that. Who here has an MDA configuration that allows friendly debugging without causing AutoCAD to crash?
Message 7 of 11

OK, here is what is required to run VS2005 with AutoCAD 2006. In VS2005, go to the Debug->Exceptions menu. Within the Exceptions dialog expand the "Managed Debugging Assistants" node. Look for LoaderLock and uncheck the "Thrown" column.

Do not disable all MDAs by setting MDA="0" in the registry as it causes problems.

Hope this helps.
Message 8 of 11
Anonymous
in reply to: jimmie_fulton

Jimmy, How cool are you!

--
Thanks - Paul
wrote in message news:5113492@discussion.autodesk.com...
OK, here is what is required to run VS2005 with AutoCAD 2006. In VS2005, go
to the Debug->Exceptions menu. Within the Exceptions dialog expand the
"Managed Debugging Assistants" node. Look for LoaderLock and uncheck the
"Thrown" column.

Do not disable all MDAs by setting MDA="0" in the registry as it causes
problems.

Hope this helps.
Message 9 of 11
Anonymous
in reply to: jimmie_fulton

>Jimmy...

Sorry Jimmie...

--
gl - Paul
"Paul Richardson" wrote in message
news:5114322@discussion.autodesk.com...
Jimmy, How cool are you!

--
Thanks - Paul
wrote in message news:5113492@discussion.autodesk.com...
OK, here is what is required to run VS2005 with AutoCAD 2006. In VS2005, go
to the Debug->Exceptions menu. Within the Exceptions dialog expand the
"Managed Debugging Assistants" node. Look for LoaderLock and uncheck the
"Thrown" column.

Do not disable all MDAs by setting MDA="0" in the registry as it causes
problems.

Hope this helps.
Message 10 of 11
cabbi
in reply to: jimmie_fulton

I'm working with VS 2008 and AutoCAD 2006. I compile my plugin DLL using framework 2.0. I did everything discussed in this and http://discussion.autodesk.com/thread.jspa?threadID=633031 but did not solve my problem, when I call 'ReadDwgFile' an exception is thrown!!! 😞

I also did anything possible with the acad.exe.config file, commented uncommented and set the different framework versions!!!

I also get the error when compiling in release mode and run AutoCAD without VS.

Any help is appreciated!!!

Cabbi Message was edited by: cabbi
Message 11 of 11
cabbi
in reply to: jimmie_fulton

Sorry, I did reply to this thread but did not see it in the forum so I opened a new thread.... now I see both! 😞

Cabbi

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost