3

I found myself in this same problem than here, I'm using windows forms in a dll (this is for an Autocad plug-in) and I cannot debug my code because I receive "The application is in break mode. your app has entered a break state, but no code is currently executing that is supported by the selected debug engine". I have tried every recommendation in this list and none worked for me. One odd thing was that I can break in the constructor but the events that use a controller/config object get that page.

Any ideas why this may be happening?

thanks in advance

user3223834
  • 59
  • 1
  • 1
  • 9
  • Are there no threads involved? – Anthony Horne May 30 '17 at 20:03
  • No yet, there is a method that will do async calls to a web server at some point but right now is just a couple of forms that use a controller to access some data in a local db with EF. But the Page shows up on every event in the form. – user3223834 May 30 '17 at 20:16
  • Most of the suggestions are where I would have started. Also, is it not open twice (or on another PC). Make sure and run a "Clean" under build - and make sure the process is not started multiple. Also, make sure your build is valid, i.e. you didn't say "compile error - continue with old build", etc. – Anthony Horne May 30 '17 at 20:24
  • 1
    Something that helped me, when I got this because of an error was the suggestion to [disable the 'Just My Code' in the debug settings](https://stackoverflow.com/a/33843838/340045). I was then able to see properly where the exception was being thrown. – Ben Aug 26 '17 at 13:05

6 Answers6

3

In my case, I was receiving this same message when calling an MVC API endpoint, and it was also throwing a stack overflow exception. The cause was an object property in an external dll which was written with a backing field. The set accessor of the property was accidentally written to set the property and not the backing field which caused an infinite loop, hence the stack overflow exception. Note the missing underscore in the setter.

private string _Prefix;
public string Prefix
{
   get { return _Prefix; }
   set { Prefix = value; }
}

Though your issue may not be exactly as mine, something similar is occurring in an external dll.

Hoodlum
  • 1,443
  • 1
  • 13
  • 24
2

Restarting visual studio solve this for me.

Ellix4u
  • 566
  • 5
  • 9
1

I've never worked with Autocad but I've made a few plugins for Solidworks and for Creo Parametrics. Here what I usually do when my breakpoint is not working:

  1. Make sure that on build tab of project settings

    • DEBUG constant is on
    • Debug info set to full
    • Optimized code is off
  2. To the code in question add System.Diagnostics.Trace.WriteLine("something unique"); and run it without visual studio attached to make sure your code is actually being called. Check with DebugView utility from sys internals.

  3. Make sure right copy of your dll is loaded :
    1. Run your solution from visual studio as you usually do
    2. Check if you are attached to the right process.
    3. Do actions in Autocad that trigger your code.
    4. Click on Break All button in Debug toolbar in VS
    5. Open Debug->Windows->Modules window and make sure that your dll is present in the list, path is correct and there's pdb file for your dll right next to it.
  4. Add calls to System.Diagnostics.Debugger.Launch(); and System.Diagnostics.Debugger.Break(); to your code.

Hope this helps, let me know if you need clarifications for any of the steps.

Vlad
  • 793
  • 6
  • 15
1

I have this problem on my Visual Studio 2017 15.8.6. Maybe my code setting is "Allow unsafe code", but it has the same error code. The solution is click Tool > Options > Debugging > General > Use Managed Compatibility Mode and activate it. I found the solution from this forum.

enter image description here

Yohanes Nurcahyo
  • 601
  • 8
  • 19
0

For me, the solution was to install the Oracle.ManagedDataAccess.Core NuGet package only. I had Oracle.ManagedDataAccess installed as well and I needed to uninstall them to fix the Break mode error.

0

I also had the same issue. After doing some analysis found out that some of the dependent projects were not built properly. Rebuilding all the dependent projects worked for me.

Aswad
  • 29
  • 2
  • 5