Debugging not hit breakpoints in .NET CORE MVC 6 application

£可爱£侵袭症+ 提交于 2019-12-04 04:30:14

actually your screen shot was not the debug output, it was the build output.

If you disable the "Enable Just My Code", and enable/disable the Microsoft symbols Server under TOOLs->Options->Debugging->Symbols, and then debug your app after you re-open it, how about the result?

If I create a new app, the breakpoint was hit normally, if I re-open the solution, actually it still could hit the breakpoint, but it is very slow. Like the screen shot 1, if you visit the "debug" output window, it would list the symbols loaded one by one, after about 1min, it would hit the breakpoint like screen shot 2. Of course, I enabled the Microsoft symbols under TOOLS->Options->Debugging->Symbols and disabled the Enable Just My Code for the above steps.

So for your issue, one possible reason is that it just loads the symbols slowly, just wait for a moment.

While Jack Zhai-MSFT's solution worked I still had some weird behavior: breakpoints were working partially. Found solution here that works perfectly: Breakpoint Failed to Bind - Visual Studio 2015 While the above link is loaded with tons of solutions in my case changing configuration from Release to Debug under Build menu Configuration Manager solved all my breakpoints related problems.

I thought I was running into this same behavior except in my case it was caused by Temporal Coupling in the Startup.cs class of my .NET Core MVC application.

I had included my app.UseMiddleware() call below my app.UseMvc() call and because of this my middleware component would initialize but was never hit by requests coming into my application. Moving my call to app.UseMiddleware call above the app.UseMvc call fixed this and now my requests are being properly routed through my custom middleware.

app.UseMVC MUST BE THE LAST "app.Use()" call in the Configure method of your Startup.cs class

I faced the same problem and none of the above solutions worked. Finally I figured out below setting works like a charm.

Go to Tools->Options->Debugging->General->Uncheck "Use Managed Compatibility Mode" checkbox

Worked for me by enabling following Debugging option "Enable .Net framework source stepping"

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