The application is in break mode. your app has entered a break state,

你说的曾经没有我的故事 提交于 2019-12-12 15:28:24

问题


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


回答1:


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.




回答2:


Restarting visual studio solve this for me.




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/44270785/the-application-is-in-break-mode-your-app-has-entered-a-break-state

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!