Debugging .NET: Autocad 2013 with Visual Studio 2012

Debugging .NET: Autocad 2013 with Visual Studio 2012

KevinMacDonald
Advocate Advocate
6,216 Views
5 Replies
Message 1 of 6

Debugging .NET: Autocad 2013 with Visual Studio 2012

KevinMacDonald
Advocate
Advocate

As the title of the question indicates I am using Autocad 2013 and Visual Studio 2012. I have installed the ObjectARX 2013 SDK and have built one of the .NET samples - Prompts.csproj for example - and have successfully installed the DLL using NETLOAD. The only problem is that I cannot debug. If I use Visual Studio to attach to the acad.exe process both Autocad and Visual Studio will freeze as soon as I run one of the Prompts.cs commands and attempt to hit a breakpoint. 

 

Visual Studio project settings of interest:

- platform target is Any CPU (I have tried all the options. Same problem)

- Target framework is .NET Framework 4.5

- Referenced DLLs are set to Copy Local = True (I have tried both True and False. Same problem).

 

Between not being able to reload a .NET DLL without restarting Autocad (because of the well known lack of a NETUNLOAD function), and not being able to debug into my code this is a very challenging development environment. I am blind with both hands tied behind my back. Any suggestions are most appreciated.

 

Thanks

Inventor 2013
0 Likes
Accepted solutions (1)
6,217 Views
5 Replies
Replies (5)
Message 2 of 6

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

>> If I use Visual Studio to attach to the acad.exe process

I never use the "attach to existing process", I have my project settings defined to start AutoCAD when I click onto "start" in my project.

 

>> Target framework is .NET Framework 4.5

Has to be 4.0

 

>> Referenced DLLs are set to Copy Local = True

Has to be set to false

 

Good luck, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 3 of 6

KevinMacDonald
Advocate
Advocate

I'll be damned! That worked. Thanks Alfred. Framework 4 instead of 4.5. Who knew? 

 

FYI In case anyone else is trying to set up an effective development environment there's a nifty little NetReload utility out there that allows one to make rapid code changes and reload your assembly on the fly via a clever workaround to the AppDomain problem. You can't line debug that way, but if you need to quickly try new things and don't want to burn the time to constantly restart Autocad it's pretry neat.

Inventor 2013
0 Likes
Message 4 of 6

Anonymous
Not applicable

Hello,

I am doing exactly the sam thing, everything works fine for me, I can step into (F8) but the problem is I can't see what is happening in AutoCAD step by step because it can't be activated or refreshed durind debug. At the end of the run AutoCAD activates and I see the whole process. I want to see step by step what happens each line of code execute. How to do this?

Best Regards

VS2012

Autocad 2012

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hi,
I was debugging my ObjectARX application, then I saw VS and ACAD crash when I want to attach VS debuger to acad , I could not find any solution just might someone else  have the same problem I am reporting my case.
After 12 hours struggling with VS and Autocade chekcing all the possible solution I found that when you debug a project that targets accoreconsole (accoreconsole dll is refrenced) in acad you can not debug when you want debug it both VS and ACad crash!!

(By the way I tried to use ACAD in place of accorconsole to debug my dll beacuse ACAD reports loading failuire  in netload command but accoreconsole does not report it. One offer to ObjectARX team, it would be nice in the case of failure in loading .net dll acccorecosnsle like ACad ireports exception (the reason that load was not sucessful like security reason or etc)
Br,

0 Likes
Message 6 of 6

fieldguy
Advisor
Advisor

Use 2 monitors