.NET

.NET

Reply
Valued Contributor
KevinMacDonald
Posts: 75
Registered: ‎12-15-2012
Message 1 of 6 (3,292 Views)
Accepted Solution

Debugging .NET: Autocad 2013 with Visual Studio 2012

3292 Views, 5 Replies
12-15-2012 03:59 PM

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
*Expert Elite*
Alfred.NESWADBA
Posts: 8,963
Registered: ‎06-29-2007
Message 2 of 6 (3,286 Views)

Re: Debugging .NET: Autocad 2013 with Visual Studio 2012

12-15-2012 04:08 PM in reply to: KevinMacDonald

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
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
KevinMacDonald
Posts: 75
Registered: ‎12-15-2012
Message 3 of 6 (3,260 Views)

Re: Debugging .NET: Autocad 2013 with Visual Studio 2012

12-16-2012 02:41 AM in reply to: Alfred.NESWADBA

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
Valued Contributor
tanerpro
Posts: 83
Registered: ‎10-07-2005
Message 4 of 6 (2,566 Views)

Re: Debugging .NET: Autocad 2013 with Visual Studio 2012

04-30-2013 01:33 AM in reply to: KevinMacDonald

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

Windows 7 (x64)
AutoCAD 2012 (x64)
Active Member
m.yenafaradam
Posts: 7
Registered: ‎05-17-2013
Message 5 of 6 (1,647 Views)

Re: Debugging .NET: Autocad 2014 with Visual Studio 2012

09-13-2013 07:05 AM in reply to: tanerpro

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,

Valued Mentor
fieldguy
Posts: 368
Registered: ‎03-31-2005
Message 6 of 6 (1,635 Views)

Re: Debugging .NET: Autocad 2013 with Visual Studio 2012

09-13-2013 08:29 AM in reply to: tanerpro

Use 2 monitors

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 or visit the Installation and Licensing Forum to get help installing your software.