.NET

.NET

Reply
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 1 of 18 (753 Views)
Accepted Solution

Debug using Visual Studio Express 2013 and AutoCad 2010/2014

753 Views, 17 Replies
03-14-2014 12:36 AM

Hi, 

 

With Visual Studio Express 2013 i'm trying to debug AutoCad2010, but it refuses to break the operation, Is it possible to debug AutoCad 2010 with VSE2013? I am using framework 3.5, because AutoCad 2010 doesn't work with 4.5

 

I have created multiple projects in VSE2008 with AutoCad 2010. That worked fine..

 

kind regards, 

 

Wouter

Hi Alfred,

 

finally i found a solution. I downgraded my Visual Basic Express 2013 to Visual Basic Express 2010, and still debugging didn't work at begin. Then I found a solution from Kean Walmsley:

 

http://through-the-interface.typepad.com/through_the_interface/2010/04/hitting-breakpoints-in-net-class-libraries-while-debugging-with-visual-studio-2010.html

 

and used solution 2:

 

"The cause of the problem boils down to the fact that VS 2010 does not choose the right version of the debugger for Class Library projects targeting prior versions of the .NET Framework: it always uses the default version, the debugger targeting v4 of the .NET Framework. This debugger doesn’t see breakpoints in projects targeting older versions of .NET."

 

Solution 2

Modify the config file of the exe that loads your AddIn (acad.exe.config, revit.exe.config, etc) so that it contains the following just before the 

</configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
</startup>

 

 

 

that worked! Now I can try to do the same when using VBE2013.

 

Using AutoCad 2010 (installed as 32bit on a 64bit machine, using Windows 7)

 

thanks for all your effort!

 

kind regards

 

Wouter

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,583
Registered: ‎06-29-2007
Message 2 of 18 (734 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 02:50 AM in reply to: wbdehaan

Hi,

 

>> i'm trying to debug AutoCad2010, but it refuses to break the operation

How does that "break the operation" look like? Do you get any messages or what happens?

At least yes, the combination of VS2013 Prof. and debug AutoCAD 2010 works well, and so I guess that the Express version does work too.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 3 of 18 (723 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 03:39 AM in reply to: wbdehaan

Hi Alfred,

 

thank you for your reply!

 

I will try to explain what i did. first I created a new project, added acdbmgd.dll and acmgd.dll, (with properties copy local: false)

then changed the testproject.vbproj file, and added 2 lines, because this option is not available in the Express edition to start AutoCad:

 

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files (x86)\AutoCAD 2010\acad.exe</StartProgram>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <DocumentationFile>testproject.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>

 

then added some simple code in class1.vb

 

Imports Autodesk.AutoCAD.Runtime

Public Module testModule
    <CommandMethod("testprog")> Sub main()

        Dim TempText As String = "Hello World"
        MsgBox(TempText)

    End Sub
End Module

- pressed 'Start- '-button in VBE: with options on the right of start-button: Debug & Any CPU

- after that AutoCad started automatically, 

- in AutoCad I typed netload, and loaded the dll from the \bin\debug\testproject.dll

- when I type 'testprog' in the command-line of AutoCad, the program is started, and gives me 'hello World'-msgbox.

 

but when I press 'Pause'-button in VBE2013, to debug my code, I get this message:

 

 

error.png

 

 

I tried the option: use managed compatibility mode in Tools > Options

debug.png

 

and also Enable native code debugging, but it doesn't work

 

debug2.png

 

I Use a 64bit machine with Windows 7, Visual Studio Express 2013, and AutoCad 2010* and AutoCad2014

(* My collegues use AutoCad2010, because I have to rewrite tons of VBA-code)

 

Hope I explained enough, awaiting your answer,

 

kind regards, 

 

Wouter de Haan

the Netherlands

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 9,583
Registered: ‎06-29-2007
Message 4 of 18 (716 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 04:08 AM in reply to: wbdehaan

Hi,

 

your path points to AutoCAD 2010 in the x86-programs path, is that really correct (as you are working on a 64bit system)?

 

>> but when I press 'Pause'-button in VBE2013, to debug my code

Do you press "pause" when the MsgBox is open or later?

What happens if you set a breakpoint at the line where you calling the MsgBox and start then the command?

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 5 of 18 (712 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 04:29 AM in reply to: Alfred.NESWADBA

Hi Alfred

 

AutoCad2010 is installed as 32bit version, to be able to use VBA, so yes this is correct. VBE starts AutoCad correctly..

 

kind regards

 

Wouter

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 6 of 18 (692 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 07:59 AM in reply to: wbdehaan
Wouter, try add reference to accoremgd.dll, then app run again
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 7 of 18 (688 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 08:16 AM in reply to: Hallex

Hi Alfred, 

 

thanks for your assistance, but unfortunately it doesn't work. I added the accoremgd.dll from AutoCad 2014 and added this reference to the project (set copy local false), and then I got 50 errors about the framework incompatability using 3.5 instead of higher. And <CommandMethod("Testprog"> became ambiguous in the autodesk.autocad.runtime namespace.

 

Is it better to downgrade visual studio to 2012 or maybe 2008 again? Or should it be able to work with debugging?

 

kind regards, Wouter

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 8 of 18 (671 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-14-2014 10:15 AM in reply to: wbdehaan
Wouter,
Try to rebuild a project using 4.0 Net.Framework
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
*Expert Elite*
Alfred.NESWADBA
Posts: 9,583
Registered: ‎06-29-2007
Message 9 of 18 (645 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-15-2014 12:53 PM in reply to: wbdehaan

Hi,

 

accoremgd.dll is only correct for AutoCAD 2013 or 2014, not for AutoCAD 2010.

My question is now: how did you install the 32bit-version of AutoCAD onto your 64bit operating system? Are you using any virtual pc or something similar?

 

>> Is it better to downgrade visual studio to 2012

At least I don't think that this is necessary, the source or the problem is imho not depending on VS2012 or VS2013.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Valued Contributor
wbdehaan
Posts: 64
Registered: ‎11-01-2001
Message 10 of 18 (617 Views)

Re: Debug using Visual Studio Express 2013 and AutoCad 2010/2014

03-20-2014 03:59 AM in reply to: Alfred.NESWADBA

Hi Alfred & Hallex,  

 

our system-adminstrator installed it using a tool, that makes it possible to install it as 32-bit, because in the 64bit version there is no VBA-support anymore. Therefore it's installed in the program files (x86) directory. 

 

@Hallex : I also tried compiling using framework 4.0 and 4.5, but no success

 

Kind regards,

 

Wouter

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.