“The breakpoint will not currently be hit. Unable to find a corresponding location”
New Unity project with a single script
Runs without errors.
Unity 5.60f3, fresh re-install
Visual Studio 2017, fresh re-install
Experience this in all other projects
Noticed Warnings related to test tools.
Went through the windows, enabled play mode, everything looks fine there.
Please Advise
Severity Code Description Project File Line Suppression State
Warning The primary reference “nunit.framework” could not be resolved because it has an indirect dependency on the framework assembly “System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which could not be resolved in the currently targeted framework. “.NETFramework,Version=v3.5,Profile=Unity Subset v3.5”. To resolve this problem, either remove the reference “nunit.framework” or retarget your application to a framework version which contains “System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”. New Unity Project
Severity Code Description Project File Line Suppression State
Warning The primary reference “UnityEngine.TestRunner” could not be resolved because it has an indirect dependency on the framework assembly “System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which could not be resolved in the currently targeted framework. “.NETFramework,Version=v3.5,Profile=Unity Subset v3.5”. To resolve this problem, either remove the reference “UnityEngine.TestRunner” or retarget your application to a framework version which contains “System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”. New Unity Project
I had a similar issue (Unity 5.6.0f3, VS 2017 Enterprise). I was still able to use breakpoints without any problems, but I got those warnings as well.
Go Project Settings → Player → Other Settings and set the API Compatibility level to .NET 2.0 (as opposed to .NET 2.0 Subset). Restart Visual Studio, Clean and Rebuild the solution. This got rid of the warnings for me.
I had this issue as well for about a week before I decided to do something about it.
What worked for me was to open one of my .cs files in Notepad++, and set the encoding to UTF-8. For some reason, all my files had changed their encoding to UTF-8 with BOM.
To do this, open one of your .cs files in Notepad++, go under Encoding->Encode in UTF-8. While you’re at it, go to Edit->EOL conversion and make sure you have the right platform selected.
That one file was now fixed for me, and all I had to do was close Visual Studio, open it again, clean and rebuild the solution. It then auto-applied that encoding to all my files, and everything worked again.
This may have also worked for me, mine was already set to .NET 2.0 so I changed it to .NET 2.0 Subset, then back, restarted VS2017, cleaned and rebuilt solution and now my breakpoints are working. It still showed the “The breakpoint will not currently be hit. Unable to find a corresponding location” warning.
I was running, had a breakpoint on Update() with nothing being hit so I came here looking for help. Saw @TacticalBlank solution & went in to check the setting. Changed it to .Net 2.0 while running & the breakpoint hit immediately!
I’m having the same issue with .NET 4. Can’t change .NET versions without breaking the project. If I do, the settings window breaks and doesn’t display anything until I restore an old copy of ProjectSettings.asset from before I changed the setting. Unity version 2018.3.0b5. Visual Studio 2017 version 15.8.7 (An older thread with similar issues was solved by upgrading to the latest versions of everything). If I use Debug.Break() it makes it pause the preview in Unity, but Visual Studio doesn’t pause. If I manually pause VS while Unity is paused at the breakpoint, I just get the No Compatible Code Running page.
I get the same unable to find a corresponding location error. I’ve tried various things from different threads, like deleting library files, and meta files, reimporting, cleaning, rebuilding, etc. Has anyone been able to fix this yet?
Every once in a blue moon, breakpoints will work. But for the most part they do not. Cannot for the life of me figure out the relevant variable. Tried deleting .sln and .csproj files, clean and rebuilding, switching .net api to 2.0 and back to 4.0, checking firewall, closing and reopening unity and visual studio.
Nothing works
Edit: Hey guys, one thing to try. I’ve notice breakpoints work pretty inconsistently with async methods. Try setting a breakpoint further upstream before your async code runs and make sure that’s able to hit. If not, clean and rebuild and close and reopen unity
In case anyone has my same issue. What fixed it for me was deleting and then undeleting the library folder of my project. I’m not sure why I’ve read so many times you can safely delete the library folder, it totally messed up my project when I did that - removing every setting in the inspector of every object. I’m not sure if it’s just coincidence, but deleting and then restoring from Git didn’t work last time I tried this a couple of months ago - but this time I restored from recycle bin and it fixed the issue.
For the sake of completeness, I’m not sure what step fixed it, but I did reload my project in unity after deleting the library folder, and again after restoring it.