Monday, April 23, 2012

No source available in Visual Studio debugging AutoCAD .NET code

AutoCAD 2011 through AutoCAD 2013 is being in progress migrating to fiberless operation. See Wikipedia for more about Fibers.

This affects ARX application using acedCommand (replaced with acedCommandS and acedCommandC), acedCmd (replaced with acedCmdS and acedCmdC) as well as ARX or .NET application using AcApDocManager functions to create, close or activate documents. If P/Invoke has been used to access acedCommand in .NET API, it will not work.  Finally LISP *error* handlers using the (command) function. In most cases you simply have to replace (command) from within an *error* handler with calls to the new (command-s) function. Worth knowing is that (command-s) is significantly faster than (command). A limitation with (command-s) is that “pause” tokens cannot be used and the expression must represent complete commands..

AutoCAD 2011 introduced two variables FIBERWORLD and NEXTFIBERWORLD to help programmers to test and migrate code.
FIBERWORLD = 1 if Fibers are being used.
Change NEXTFIBERWORLD to 0 to disable fibers and 1 to enable fibers. Close and relaunch AutoCAD, or close all the current documents in AutoCAD and then open/new one.

If breakpoints in custom forms being opened using ShowModalDialog or ShowDialog cannot be hit when debugging .NET addins in Visual Studio 2010 the workaround is to set AutoCAD to run in fiberless operation (FIBERWORLD = 0). When you try to debug you may see this message in Visual Studio: No Source Available. No symbols are loaded for any call stack frame. The source code cannot be displayed.

The problem that you may have with FIBERWORLD = 0 is that the Ribbon is not working, you may get strange crashes and have other issues. If you cannot type any commands you may need to disable and enable the command line using the application menu and search for command. If you need to work on a specific drawing it can help to load it automatically from within the Visual Studio debugger as the open command may break the command functionality.

When ready remember to set back AutoCAD to run in fiber mode again.

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner