Author Topic: Problem with breakpoints not hitting and edit and continue not working  (Read 8119 times)

0 Members and 1 Guest are viewing this topic.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
I need some help figuring out why the features mentioned in the subject line have stopped working.
I have been bouncing between AutoCAD 2011 and 2013 on various projects. These have always worked fine but recently that changed.
I went as far as reinstalling VS.
I've read dozens of posts on line over the last week but none got the problem solved.

Current project is in VS 2012 for AutoCAD 2013.

Any help appreciated.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Jeff H

  • Needs a day job
  • Posts: 6143
Re: Problem with breakpoints not hitting and edit and continue not working
« Reply #1 on: February 05, 2013, 02:48:48 PM »
Just to get them out of the way,


You are building and debugging with debug mode?
32 bit or 64 bit and which platform or platforms are you building for?


And the not so technical question,
Do the the little red circles for the breakpoints fill in solid after you netload?


mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Problem with breakpoints not hitting and edit and continue not working
« Reply #2 on: February 05, 2013, 02:59:21 PM »
Right,
Debug mode.
OS is 32 bit Win 7 running on VMWare. Building for AnyCPU.

Circles were empty until I "NETLOAD"ed my dll. Then they filled.

Command class has command that opens a dialog. I can step through the dialog initialization but when the Application.ShowDialog happens all breakpoints are ignored.

Code - C#: [Select]
  1.         [CommandMethod("NCICommands", "NCI", null,
  2.             CommandFlags.Modal | CommandFlags.DocExclusiveLock | CommandFlags.NoBlockEditor,
  3.             null, "NonCatalogItems", "NonCatItemsHelpID")]
  4.         public void NCI_Method()
  5.         {
  6.             try
  7.             {
  8.                 frmNonCatItemsTable frm = new frmNonCatItemsTable(); // can step through form initialization
  9.                 Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(frm); // misses breakpoints in form Load event
  10.             }
  11.             catch (System.Exception ex)
  12.             {
  13.                 System.Windows.Forms.MessageBox.Show("Error starting NonCatalog program\n" + ex.Message, "Error");
  14.             }
  15.         }
  16.  
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Problem with breakpoints not hitting and edit and continue not working
« Reply #3 on: February 05, 2013, 03:08:10 PM »
When it hits ShowModalDialog(frm) I get a tab in VS named "Source Not Available".
It has a caption "Code not running".
The message is "The current thread is not currently running code or the call stack could not be obtained"

If I close the tab and press F11 the breakpoints in the Load event are ignored and the dialog displays.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

n.yuan

  • Bull Frog
  • Posts: 347
Re: Problem with breakpoints not hitting and edit and continue not working
« Reply #4 on: February 05, 2013, 03:32:13 PM »
You need to turn off Fiber by entering NEXTFIBERWORLD at command line, and set value to 0.

However, after this, the ribon/menu would stop working. You need to be a good CAD user to run AutoCAD command from command line.

See this post

http://adndevblog.typepad.com/autocad/2012/12/breakpoints-in-custom-form-not-hit-when-debugging-net-addin-for-autocad-2012-from-visual-studio-2010.html?cid=6a0167607c2431970b017d3ef484d1970c

You can also search Kean's blog for Fiber, posted a couple of years ago.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Problem with breakpoints not hitting and edit and continue not working
« Reply #5 on: February 05, 2013, 04:19:22 PM »
Thanks for the nudge Jeff.

Thanks for being a genius Norman, that was it! FINALLY!
This is one of the things I find most frustrating about programming. The "secret passwords" that are not apparent, should not be needed and could not be guessed. FIBER? really? FIBER?

I remember reading Kean's post back in 2011 and putting it out of my mind because I wasn't having that problem. I don't know what caused that to change but I'm glad to be working more efficiently again.

Anyway thanks for help.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

cvcolomb

  • Guest
Thanks for this guys, just saved my bacon as well !

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8588
  • AKA Daniel
FYI, I found that changing
<startup useLegacyV2RuntimeActivationPolicy="true">
To
<startup useLegacyV2RuntimeActivationPolicy="false">

Is enough to get the debugger to work in forms, not always, but in most cases