- Home /
Breakpoints in Visual Studio debugger are not working
When I hover over the circle next to the breakpoint, I get the following message: “The breakpoint will not currently be hit. Unable to find a corresponding location”.
I’ve tried the following solutions:
- Deleting all files in Library/ScriptAssemblies and restarting Unity (as suggested here)
-Reinstalling Unity
-Reinstalling Visual Studio
-Cleaning and rebuilding my solution in Visual Studio
-Reverting my project to an earlier version and re-adding the changes I want to make to my project
After reverting my project, the debugger started working properly, buy after re-adding the changes, the breakpoints stopped working again
Edit: Also, the compiler is set to debug.
$$anonymous$$ake sure the compiler is set to generate a DEBUG (not release) build. $$anonymous$$inda obvious I know, but I still manage to mess it up often enough.
ok. Here is another check. This one confirms the debugger is attaching to the correct process. First, make sure the game is NOT playing the Unity Editor. Change the Attach To Unity drop down, to the Attach to Unity and Play option, and click it. Does this make the unity editor start playing? Also, are you using any custom/third-party DLLs?
Clicking Attack to Unity and Play from Visual Studio starts the application in Unity. I use two third-party dlls in my application: $$anonymous$$athNet.Numerics and System.Threading.
another thing if it's a build for UWP, you need to check build C# projects (or whatever the name in PlayerSettings was)
I'm, not targeting the Universal Windows Platform.
Answer by lagrier98 · Jul 04, 2018 at 03:54 AM
After playing around a little bit, I tried deleting .meta files in my project and changing the Api Compatibility Level setting (in Edit->Project Settings->Player) from ".NET Standard 2.0" to ".NET 4.x", and this has resolved the issue.
Can confirm, the API Compatiblity Setting switch did the trick, did not need to delete .meta files.
I found that just changing the setting to either .NET compatibility level is enough. Seems like toggling it must force a regeneration of symbols.
I tried this a few times and it did not fix the issue for me. I eventually rebooted, updated the Visual Studio Installer, then reinstalled the Unity development package, rebooted again (while standing on one leg and clapping) and after all that breakpoints worked again.
Your answer
Follow this Question
Related Questions
How to debug an Android application in Visual Studio using USB debugging? 2 Answers
Is there a way how to wait for debugger to connect/start and debug built application from VS? 0 Answers
Debugging on device with Visual Studio 2015 0 Answers
How to load symbols for external managed DLLs? 0 Answers
Unable to debug .NET 4.x 0 Answers