The breakpoint will not currently be hit. Unable to find a corresponding location

  • Unable to debug unity project.
  • “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

1 Like

I have the same issue :frowning:

Ah yeah, just ran into this too…

Same here with that two warnings.

I installed VS 2015 and then Unity 5.6 on a new PC and got this on my project.

However, my project can still break during debug as usual.

Same issue.

I have Unity 5.6.0f3 and Visual Studio Community 2017 on Windows 10, fresh install of windows and Unity and visual studio.

Same issue.

Like Nickromancer, I can still break during debug.

However I don’t like seeing warnings I didn’t cause and can’t control, and can’t be sure won’t cause problems at some later stage…

Does anyone know how to get rid of it?

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.

5 Likes

I found that @TacticalBlank solution worked! Definitely try that!

Thanks ShikenNuggets, you’re a lifesaver. Breakpoints weren’t working AT ALL for me and nothing I tried worked until this.

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.

I hope this works for you!

1 Like

@TacticalBlank solution worked for me as well! Many thanks… I could turn it back to 2.0 subset again and it still works :slight_smile:

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!

Mine was already on .NET 2.0, I started the game up, changed it to subset, then changed it back and it started working.

Confirmed still an issue with Unity 2018 2.6f1 and VS 2015 (latest VSTU). Had to change API Compatibility from .NET 4.x to .NET Standard 2.0.

This is pretty bad. So we can’t debug if we use .NET 4?

[Edit]: Nevermind, it’s still broken… Worked for a single session then broke again even with .NET 2.0

[Edit]: After setting the scripting backend to .NET 3.5 it started working, but now it freezes randomly every now and then.

1 Like

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?

Unity 2018.1.0f1, VS 2017 v15.7.6

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.

The solution is to put in every file breakpoint with partial class. Once it get hit rest files will load.

Unity randomly picking 1 file with partial class for debug, thats why its sometimes working and sometimes not.

5 Likes

I switched to using JetBrains Rider about a year ago, never had an issue since.