I recently installed the latest Autocad .NET Wizards, hoping that I would finally be able to debug my plugin. I've been developing with ObjectARX for over a year now. All previous attempts to get the debugger working on my DLL failed and I gave up.
The latest wizard installed OK, but when I followed the example, trouble started when I simply saved the project. Most of the ObjectARX symbols showed red (undefined) until I added references to "Autodesk.AutoCAD.Interop" and "Autodesk.AutoCAD.Interop.Common". These are both in C:\ObjectARX 2011\inc-x64\ The errors went away after adding these two references, but the question remains as to why this was necessary since the wizard should work out of the box as shown in the demos.
After staring debug (F5), AutoCAD starts and I NETLOAD my DLL. My plugin comes up fine, but breakpoints are ignored :-(
I tried some of the solutions on Through the Interface and elsewhere to no avail. Hoping I don't have to give up again :-(
I'm on 64-bit Windows 7, Visual Studio 2010 Pro (4.0.30319) and AutoCAD 2011. I'm developing in Visual Basic.
Hello and thanks for responding.
Yes, I tried just a bare plugin using the wizard supplied template. I'm assuming that's what you mean. That is how I saw the problems I originally described.
It had only the default ObjecARX references defined:
AcDbMgd.dll (C:\ObjectARX 2011\inc\AcDbMgd.dll)
AcMgd.dll (C:\ObjectARX 2011\inc\AcMgd.dll)
the only other non-standard references inserted by the wizard were:
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCo
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFr
Thanks for helping out, really appreciate it. I can't be the only one to have seen this. I spent quite some time searching the forums though, before posting and didn't see anything applicable.
Yes, but you mentioned that you made changes. The questions I asked required specific information. If you look at the properties for those references it will tell you where the file was actually found (or an exclamation mark if not found).
Also, if all you did was add the interop's, those are not adde by default. Those are only needed if you are using COM objects. Perhaps you are converting some existing vba code? When you create a new project, the dialog offers you the opportunity to add additional refrerences. You can check the appropriate boxes.
As far as debugging goes, do you have your project in debug mode? Run the cofig mgr (Debug>Configuration Manager) and set the solution to Debug. When you are ready to debug, run the netload the dll from the Bin/Debug folder. When you are ready to deploy, set it back to Release mode and then distribute the dll version from the Bin/Release folder.
OK, sorry, misunderstood your question. Here is a screenshot of the references after I added the following:
After that all I did was add a command to test breakpoints and execute.
Can you do debugging with a project not created via wizard? That is, jsut create a plain Windows class Library project and add reference to acdbmgd.dll/acmgd.dll, and write a simple command method and then run debugging. Can you do that?
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. So, you may need to manaully set reference to the interop assemblies, if you HAVE TO use COM API (do not over-use/abuse them! in many cases, you do not need them, And with C# 4.0 dynamic, you can call COM API without having to have reference to COM API (equivalent to VB's late binding).
2. Lt looks you are targeting .NET 3.x, because reference to PresentationCode.dll 3.0. You need to verify which version of .NET of your AutoCAD 2011 uses by looking into acad.exe.config for something "<<supportedRuntime .... V4.0.../>. If you do not see it or it is commented out, than your AutoCAD 2012 runs on .NET 3.5. Otherwise, it is on .NET 4.0. Then you make sure your project targets the same version of .NET.
3. When targeting .NET 4.0, there is a very annoying issue with AutoCAD using "Fiberworld". Enter "Fiberworld" at AutoCAD command line, if the value is 1, it is oftern the debugging break point would be missed when debugging. You need to enter "NextFilberworld" at command line and then set it to 0. Now you can debug, but AutoCAD's ribbon/menu/toolbar would likely stop working.
Tried just starting Visual Studio, then:
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.
> 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:
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.
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.
Search the Autodesk Knowledge Network for more content.
New: Get an Activation Code
Mac OS X 10.12 Support
Windows 10 Support
Autodesk Online Store Help
Serial Numbers & Product Keys
Installation & Licensing
Online Activation & Registration
Network License Administration