.NET

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

Problems with the dotNET wizard - references and breakpoints

343 Views, 14 Replies
06-17-2012 10:55 AM

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.

 

Gary

Distinguished Contributor
eljobe
Posts: 704
Registered: ‎01-24-2003
Message 2 of 15 (320 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 08:27 AM in reply to: ghethco

Try creating a blank new project and check the references. Are they included? What files do they actually point to?

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

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 09:44 AM in reply to: ghethco

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\PresentationCore.dll

  C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll

 

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.

 

Gary

Distinguished Contributor
eljobe
Posts: 704
Registered: ‎01-24-2003
Message 4 of 15 (312 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 09:53 AM in reply to: ghethco

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.

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

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 12:11 PM in reply to: eljobe

OK, sorry, misunderstood your question.  Here is a screenshot of the references after I added the following:

 

C:\ObjectARX 2011\inc-x64\Autodesk.AutoCAD.Interop.dll

C:\ObjectARX 2011\inc-x64\Autodesk.AutoCAD.Interop.Common.dll

 

Refs.jpg

 

After that all I did was add a command to test breakpoints and execute.

 

NewCode.jpg

 

Gary

 

Distinguished Contributor
eljobe
Posts: 704
Registered: ‎01-24-2003
Message 6 of 15 (300 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 12:46 PM in reply to: ghethco

So, were you able to debug?

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

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 01:16 PM in reply to: eljobe

Sorry, mentioned that back in the first post.  No, breakpoints don't work so can't get into the debugger.

 

Gary

Distinguished Contributor
eljobe
Posts: 704
Registered: ‎01-24-2003
Message 8 of 15 (294 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 01:31 PM in reply to: ghethco

I meant, after you checked your debug settings like I mentioned...assuming you did so. You didn't say what your project settings were.

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

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 01:35 PM in reply to: eljobe
OK, will do so later today and let you know. Don't have the right machine in front of me. Gary -- Gary Hethcoat gary.hethcoat@gmail.com Solar PV Systems Engineer Petersen Dean Roofing & Solar http://www.petersendean.com Design4Solar http://www.design4solar.com
*Expert Elite*
norman.yuan
Posts: 944
Registered: ‎04-27-2009
Message 10 of 15 (285 Views)

Re: Problems with the dotNET wizard - references and breakpoints

06-18-2012 03:18 PM in reply to: ghethco

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?

 

Other things:

 

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.

 

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