.NET

.NET

Reply
Contributor
ghethco
Posts: 12
Registered: ‎06-17-2012
Message 11 of 15 (260 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 05:06 PM in reply to: norman.yuan

Tried just starting Visual Studio, then:

  • Create a class library project (tried both .NET 4.0 and 3.5 as targets)
  • Put in the runtime references as usual, AcDbMgd & AcMgd
  • Created a simple <CommandMethod> as before
  • In Debug -> Configuration, set to "Debug" - not "Active (Debug)"
  • In Debug - Start external program: C:\Program Files\Autodesk\ACADM 2011\acad.exe
  • F5...

With both 3.5 and 4.0 targets, AutoCAD appears to be unhappy, throws an exception:

 

"Provide value on 'System.Windows.Markup.StaticExtension' threw an exception."

 

AutoCAD is frozen at this point, though it dies gracefully when I do "Stop Debugging".

 

I think I tried this before last year and also didn't have any luck.  Maybe the wizard is doing some other magic to launch AutoCAD properly?

 

I'm going to try a few other things and report back later.  Thanks for helping.  Maybe others will also find this helpful.

 

Gary

 

Contributor
ghethco
Posts: 12
Registered: ‎06-17-2012
Message 12 of 15 (260 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 05:26 PM in reply to: norman.yuan

> 1. I never used the wizard (and do not feel I ever need it). But I can imagine the reference to COM APIs contained in Autodesk.AutoCAD.Interop and ObjectDBX Common Library is not MUST-HAVE stuff, so by default the wizard may not add reference to them.

 

I didn't add anything to the code the wizard produced other than that basic command method.  It targets .NET 3.5.

 

It had unresolved symbols marked red when I tried to save, pretty much all of them.  I did notice that the Interop references were there, but the instructions for the Wizard implied that you don't need them.  Here's what I get:

 

 

Acad01.jpg

 

And...

 

Acad02.jpg

 

Everything I've read and heard says to use .NET 3.5 as a target for ObjectARX.

 

When I use the checkboxs provided by the wizard for Interop, I *still* get unresolved symbols (even after saving and restarting Visual Studio and reloading the project.

 

Can't help but wonder if there's something weird about my system (?).   I'm running vanilla Win7 and Visual Studio, no special mods or anything.  Same with AutoCAD, other than the ObjectARX development I'm doing.  My plugins work fine, they just won't allow debugging.

 

Gary

 

 

Contributor
ghethco
Posts: 12
Registered: ‎06-17-2012
Message 13 of 15 (249 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-19-2012 04:43 AM in reply to: ghethco

OK, tried again this morning with the non-wizard method.  Last time I forgot to set CopyLocal=False on the references.  That's apparently why AutoCAD was throwing an exception.  This time the behavior was exactly like the wizard version, everything worked, just didn't stop at the breakpoint.

 

Gary

Distinguished Contributor
eljobe
Posts: 707
Registered: ‎01-24-2003
Message 14 of 15 (243 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-19-2012 07:07 AM in reply to: ghethco

Did you do this? After acad starts, type NETLOAD, select the dll from Bin/Debug?

Contributor
ghethco
Posts: 12
Registered: ‎06-17-2012
Message 15 of 15 (240 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-19-2012 07:19 AM in reply to: eljobe
Yes. That much I have figured out :-)
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.