C# VS2010 Entering break mode failed

2019-02-02 03:12发布

I was having some problems with my breakpoints later in my program saying that they would not be hit because the source code and the compiled code was different. I decided to put a break point on my public MainWindow() function, and see what happened.

Now I get the error that Entering break mode failed for the following reason: Source file 'F:\cAdmin\OO\OO\MainWindow.xaml.cs' does not belong to the project being debugged.

I find this funny because my project is stored on my flash drive (L:) and not F:.

I have rebuilt my project and cleaned it (many times), restarted my computer, moved my Flash drive, and anything else that I can think of.

8条回答
Explosion°爆炸
2楼-- · 2019-02-02 03:36

The solution for me was a little more esoteric to say the least! I had a workflow.xaml in an Azure WorkerRole project and it was set to BuildAction: XamlAppDef instead of None. For some reason, this caused the project to fail to pick up any changes to other files - even though VS2013 reported a successful build - which resulted in the "Entering break mode failed" error when attempting to debug the WorkerRole.

Other symptoms included types not being recognized (i.e. coloured by the IDE) and intellisense not working. Setting the xaml file build action to "none" fixed the problem (I dynamically load the workflow in any case).

I mention this just in case someone else has done something similar and the other solutions do not work.

查看更多
闹够了就滚
3楼-- · 2019-02-02 03:38

Visual Studio 2012 Update 3

Didn't work:

  • Rebuild Solution
  • delete .SUO
  • Delete Obj and Bin directories

Did work:

Tools->Options->Debugging->Edit and Continue->uncheck Edit and Continue checkbox

查看更多
虎瘦雄心在
4楼-- · 2019-02-02 03:42

For me, selecting Project|Add Existing Item, and then selecting the file named in the error message worked.

查看更多
再贱就再见
5楼-- · 2019-02-02 03:44

I had the same issue when I was trying to copy over a project that was not in source control.

The solution to the problem was that the bin directory was marked as read only (must have happened during the copy) and as a result the project was running on libraries built on a different host and it was unable to step through.

Make sure you manually delete all items in the bin directory and make sure the 'bin' directory can be written to.

查看更多
走好不送
6楼-- · 2019-02-02 03:49

I had this on a set of solutions we started to maintain for a client and migrated to Visual Studio 2010. The "delete the .suo file" did not work.

Somehow the set of sources included two assembly projects into the same directory, sharing one source file file. That file itself was not in the warning dialog.

This solved the problem:

  1. split the assembly projects in separate directories, and
  2. move the shared file into a 3rd assembly (also in a separate directory).
查看更多
贪生不怕死
7楼-- · 2019-02-02 03:51

Tried this, but it didnt work. For me in the end solved:

Build > Clean Solution Build > Build Solution (F6)

查看更多
登录 后发表回答