.Net 2.0 errors with ADT2006

.Net 2.0 errors with ADT2006

Anonymous
Not applicable
763 Views
10 Replies
Message 1 of 11

.Net 2.0 errors with ADT2006

Anonymous
Not applicable
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!
0 Likes
764 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
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?
0 Likes
Message 3 of 11

Anonymous
Not applicable
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?
0 Likes
Message 4 of 11

Anonymous
Not applicable
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.
0 Likes
Message 5 of 11

Anonymous
Not applicable
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.
0 Likes
Message 6 of 11

Anonymous
Not applicable
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?
0 Likes
Message 7 of 11

Anonymous
Not applicable
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.
0 Likes
Message 8 of 11

Anonymous
Not applicable
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.
0 Likes
Message 9 of 11

Anonymous
Not applicable
>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.
0 Likes
Message 10 of 11

Anonymous
Not applicable
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
0 Likes
Message 11 of 11

Anonymous
Not applicable
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
0 Likes