.NET

Reply
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 1 of 11 (56 Views)

.Net 2.0 errors with ADT2006

56 Views, 10 Replies
03-12-2006 10:13 PM
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!
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 2 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-13-2006 02:39 PM in reply to: jimmie_fulton
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?
*Paul Richardson
Message 3 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-13-2006 03:32 PM 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?
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 4 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-13-2006 04:30 PM in reply to: jimmie_fulton
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.
*Paul Richardson
Message 5 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-13-2006 04:49 PM 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.
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 6 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-16-2006 01:57 PM in reply to: jimmie_fulton
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?
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 7 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-16-2006 02:12 PM in reply to: jimmie_fulton
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.
*Paul Richardson
Message 8 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-17-2006 10:02 AM 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.
*Paul Richardson
Message 9 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

03-17-2006 10:03 AM 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.
Contributor
cabbi
Posts: 14
Registered: ‎03-15-2007
Message 10 of 11 (56 Views)

Re: .Net 2.0 errors with ADT2006

06-12-2008 01:01 AM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community