• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Valued Contributor
    Posts: 62
    Registered: ‎12-15-2012
    Accepted Solution

    Debugging .NET: Autocad 2013 with Visual Studio 2012

    954 Views, 3 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
    Please use plain text.
    *Expert Elite*
    Posts: 6,460
    Registered: ‎06-29-2007

    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
    -------------------------------------------------------------------------
    Please use plain text.
    Valued Contributor
    Posts: 62
    Registered: ‎12-15-2012

    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
    Please use plain text.
    Valued Contributor
    Posts: 62
    Registered: ‎10-07-2005

    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)
    Please use plain text.