Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code)

Visual StudioBreakProjects and-Solutions

Visual Studio Problem Overview


Visual Studio 2017 breaks in debug mode and displays the message:

> Your app has entered a break state, but there is no code to show > because all threads were executing external code (typically system or > framework code).

The message is in the Break Mode Window.

What to do?

Visual Studio Solutions


Solution 1 - Visual Studio

Click on "Continue execution"

enter image description here

Then you will have the stacktrace in the output tab

enter image description here

Solution 2 - Visual Studio

  1. First check all your common exception setting run time in your visual studio so that you can get the actual error.

enter image description here

  1. During loading you application check that is their any method which is throw new NotImplementedException();

In my case i use INavigationAware which was throw new NotImplementedException(); i just remove those

  1. In you all project update all from nuget.

  2. Clean and rebuild you project.

Solution 3 - Visual Studio

In my case I just need to restore the list of exception settings to the default settings. Restore button

Solution 4 - Visual Studio

I got this situation when my "Platform Target" in my Project Properties was set to "Any CPU" and "Prefer 32-bit" was selected.

I switched Platform Target to "x64" since I am using 64-bit assemblies and then I could run/debug normally.

Solution 5 - Visual Studio

This solution is for people who get this error in WPF application. I got this error when i moved mainwindow.xaml to view folder and forgot to update in App.Xaml. after updating as StartupUri="View/MainWindow.xaml" the main window loaded without warning.

Solution 6 - Visual Studio

For me, I received the error when my console application was set in Release Mode. Switching to Debug mode fixed the issue.

Solution 7 - Visual Studio

Check for any case of circular dependency while injecting dependencies.

Solution 8 - Visual Studio

This type of issue please check property and Accessories. We should return correct field and check value field.

Example:

private string NameField;
public string Name
{
  get
  {
  return NameField;
  }
  set
  {
  nameField=value;
  }
}

Solution 9 - Visual Studio

Just had a similar issue in VS2019, I ended up needing to rebuild all in order to resolve the issue despite having manually built many times.

Solution 10 - Visual Studio

I hit this earlier today with a C++ console application. Disabling "just my code" and selecting the Microsoft symbol server fixed this issue.

ToolsOptionsDebuggingGeneralUntick "Enable Just My Code"

enter image description here

ToolsOptionsDebuggingSymbolsTick "Microsoft Symbol Servers"

enter image description here

Solution 11 - Visual Studio

First drag the Break Mode Window to the Call Stack Window to get an overview again.

Then, check whether the Solution Explorer Window is in source mode. The 4th button from the left has a drop-down. Make sure the *.sln, i.e. classic solution mode is selected.

I didn't know this and was surprised to find that in "source mode", i.e. the other possibility, the above mentioned message is displayed.

Solution 12 - Visual Studio

I got this when I accidentally set the startup project to a class library instead of the end project (in this case, a WPF application).

Solution 13 - Visual Studio

Observed same error and resolved it by:

  • Removing duplicate configs from section
  • Removing extra/unused characters (by mistakenly entered)

Solution 14 - Visual Studio

This occurred for me when I placed the connectionStrings config item in the wrong spot in app.config.

Solution 15 - Visual Studio

check your Ip address (it must be the same as the listening adress if you'r not using the loopbach address)

Solution 16 - Visual Studio

Error: IOException Cannot locate resource

Most of the time this error occur when using visual studio form applications.

To solve this error you can go to your App.xaml file and edit SratupUri to your current xaml form name.

<Application x:Class="AppName.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
    </Application.Resources>
</Application>

Solution 17 - Visual Studio

You can also experience this issue if you've altered the build process with something like this to remove the PDB files. Typically I recommend if you want to remove the PDB files make the configuration specific to the "Release" configuration:

<Target Name="RemoveTranslationsAfterBuild" AfterTargets="AfterBuild" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <RemoveDir Directories="@(FluentValidationExcludedCultures->'$(OutputPath)%(Filename)')" />

    <ItemGroup>
        <PDBFilesToDelete Include="$(TargetDir)\*.pdb"/>
    </ItemGroup>
    <Delete Files="@(PDBFilesToDelete)" />
</Target>

Then Follow @Eric's recommendations when debugging run the build under the "Debug" configuration.

Solution 18 - Visual Studio

I got similar issue, after spending 2 days we figured out it was due to my application was terminated from out side at the same time I was debugging.

Solution 19 - Visual Studio

Had the same problem, this was due to having the build set to release build. Then when asked if I would like to debug, I accidentally clicked ignore always.

I changed it to debug mode in the properties settings but the error was still there.

You will also need to change this in the configuration manager from Build/configuration manager and set Configuration to Debug as well.

Solution 20 - Visual Studio

Same here. Reinstalling VS 2019 solved it.

Solution 21 - Visual Studio

Even though this is an older post, I thought the solution to my problem could help others looking for an answer to this problem.

Using the above suggestion from Led Machine - to see the stack trace, I found the following top lines.

Exception Info: System.NullReferenceException at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean) at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean) at System.Web.LegacyAspNetSynchronizationContext.CallCallbackPossiblyUnderLock(System.Threading.SendOrPostCallback, System.Object)

Googling this stack trace, sent me to this page: https://techcommunity.microsoft.com/t5/iis-support-blog/crash-at-system-web-legacyaspnetsynchronizationcontext/ba-p/1536553

Apparently, the problem was related to my application being configured to use Legacy ASP.NET Synchronization Context, and in certain parts of the code, I was using some new features, such as Tasks. The old (Legacy) context cannot handle some asynchronous calls properly and this leads to the crash as observed in the above.

The fix is to insert the following line in your web.config:

<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>

Solution 22 - Visual Studio

I had a similar issue when debugging a VSTO Excel add-in. After trying everything, I resolved the issue by disabling a realtime protection module on my antivirus software.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGerardView Question on Stackoverflow
Solution 1 - Visual StudioLed MachineView Answer on Stackoverflow
Solution 2 - Visual StudioMohammad Atiour IslamView Answer on Stackoverflow
Solution 3 - Visual StudiodevowiecView Answer on Stackoverflow
Solution 4 - Visual StudioKevin UIView Answer on Stackoverflow
Solution 5 - Visual StudioPadmanabanView Answer on Stackoverflow
Solution 6 - Visual StudioEricView Answer on Stackoverflow
Solution 7 - Visual StudioHoney Dev PView Answer on Stackoverflow
Solution 8 - Visual StudioRajenthiran TView Answer on Stackoverflow
Solution 9 - Visual Studiojeff curleyView Answer on Stackoverflow
Solution 10 - Visual StudioDanView Answer on Stackoverflow
Solution 11 - Visual StudioGerardView Answer on Stackoverflow
Solution 12 - Visual StudioZev SpitzView Answer on Stackoverflow
Solution 13 - Visual StudioRamanujam AllamView Answer on Stackoverflow
Solution 14 - Visual StudioMike S.View Answer on Stackoverflow
Solution 15 - Visual StudioFatma LabidiView Answer on Stackoverflow
Solution 16 - Visual StudioSmit PatelView Answer on Stackoverflow
Solution 17 - Visual StudioDavid RogersView Answer on Stackoverflow
Solution 18 - Visual StudioImadView Answer on Stackoverflow
Solution 19 - Visual StudioLostLightView Answer on Stackoverflow
Solution 20 - Visual StudioADBFView Answer on Stackoverflow
Solution 21 - Visual StudioAndre VoldView Answer on Stackoverflow
Solution 22 - Visual StudioBlobbyView Answer on Stackoverflow