.NET

.NET

Reply
Contributor
pavel.shkleinik
Posts: 17
Registered: ‎02-22-2010
Message 1 of 5 (999 Views)

Debug problems with Visual Studio 2010 and AutoCAD 2009

999 Views, 4 Replies
12-19-2010 04:23 PM

 

Hello, I got a debug problem with Visual Studio 2010 and AutoCAD 2009.

 

Problem description:


In project start up options I set to run acad.exe. I set up output directory for my plugin to the same path, that at in the AutoCAD registry. So, when I hit F5 key AutoCAD starts and it loads just builded version of plugin. I set breakpoint at IExtensionApplication.Initialize() methodand it works perferctly. But when during debug I try to call some method marked with [CommandMethod("Method")] attribute AutoCAD says, that the commandis unknown. When I start AutoCAD with the same dll (but not from debug) is see all my method marked with [CommandMethod()] attribute. 


Previously I used Visual Studio 2008 with same AutoCAD version but I had no problem with debugging. Please, help.

Best Regards,
Pavel Shkleinik
Active Contributor
FritsA4
Posts: 26
Registered: ‎09-15-2010
Message 2 of 5 (965 Views)

Re: Debug problems with Visual Studio 2010 and AutoCAD 2009

12-20-2010 03:17 AM in reply to: pavel.shkleinik

My solutions for VisStudio 2010+AutoCAD 2011 are:

    I:edit: acad.exe.config, add
          <startup>
            <supportedRuntime version="v2.0.50727" />
          </startup>
        </configuration>
    or II:
           1. Right-click the Solution in the Solution Explorer and select Add -> Existing Project... >acad.exe
           2. Right-click on the Project that has just been added and select Set as StartUp Project
           3. Right-click on the Project and select Properties
           4. Set the Debugger Type to Managed (v2.0, v1.1, v1.0)

 

 

Contributor
pavel.shkleinik
Posts: 17
Registered: ‎02-22-2010
Message 3 of 5 (951 Views)

Re: Debug problems with Visual Studio 2010 and AutoCAD 2009

12-20-2010 01:48 PM in reply to: FritsA4

So, It seem that you didn't understand me.

 

Debugging works well and all breakpoints are available. But when I try to call some Command from AutoCAD it says, that this Command is Unknown. Only if I in debug mode.

 

I want to remind, that breakpoint at IExtensionApplication.Initialize() works well and I can debug this method. I've marked this method with "Command" attribute and it is called on assembly load and I can debug it, but when plugin initialization finishes, I cannot call the method. AutoCAD environment says "Unknown command

Best Regards,
Pavel Shkleinik
Contributor
pavel.shkleinik
Posts: 17
Registered: ‎02-22-2010
Message 4 of 5 (948 Views)

Re: Debug problems with Visual Studio 2010 and AutoCAD 2009

12-20-2010 02:03 PM in reply to: pavel.shkleinik

Some more symptoms that may be can help to find solution

 

1 I start AutoCAD and I can to run any command from my plugin.

2 I attach to acad.exe process and all breakpoints becomes available

3 When I try to call some command to rich my break point than AutoCAD hangs

Best Regards,
Pavel Shkleinik
Mentor
JamieVJohnson2
Posts: 170
Registered: ‎08-26-2010
Message 5 of 5 (941 Views)

Re: Debug problems with Visual Studio 2010 and AutoCAD 2009

12-20-2010 03:04 PM in reply to: pavel.shkleinik

1 or more things is happening.

1.  Your dll you reference in Debug is not there when it runs without debug, or the path has changed to it, or something like that.

2.  You are not autoloading it, and need to force netload it.

 

What I would do...  I would run ACAD normally, and then force load the dll manually (NETLOAD command).  If that is working ok, then I would check the registry entry to see if it is properly mapped for the CURRENT user.  Yep it can be different for every user.

 

If you didn't make it past the first idea, then possibly the dll, is trying to copy to source the acad dlls (bad mojo), and that causes the Netloading process to abort.

jvj

jvj
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.