Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

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

Discussion in 'External Tools' started by nventimiglia, Apr 7, 2017.

  1. nventimiglia

    nventimiglia

    Joined:
    Sep 20, 2011
    Posts:
    153
    • 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

    upload_2017-4-6_17-36-34.png
     
    Gwom likes this.
  2. Gwom

    Gwom

    Joined:
    Aug 5, 2015
    Posts:
    5
    I have the same issue :(
     
  3. Democide

    Democide

    Joined:
    Jan 29, 2013
    Posts:
    288
    Ah yeah, just ran into this too...
     
  4. Nickromancer

    Nickromancer

    Joined:
    Jul 31, 2016
    Posts:
    20
    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.
     
    Last edited: Apr 25, 2017
  5. hoesterey

    hoesterey

    Joined:
    Mar 19, 2010
    Posts:
    543
    Same issue.
     
  6. fatboynotslim

    fatboynotslim

    Joined:
    Aug 19, 2013
    Posts:
    6
    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?
     
  7. ShikenNuggets

    ShikenNuggets

    Joined:
    Apr 28, 2014
    Posts:
    1
    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.
     
  8. TenKHoursDev

    TenKHoursDev

    Joined:
    Nov 9, 2014
    Posts:
    978
    I found that @ShikenNuggets solution worked! Definitely try that!
     
  9. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    5
    Thanks ShikenNuggets, you're a lifesaver. Breakpoints weren't working AT ALL for me and nothing I tried worked until this.
     
  10. Legend_Bacon

    Legend_Bacon

    Joined:
    Jan 19, 2016
    Posts:
    2
    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!
     
  11. CaptainKirby

    CaptainKirby

    Joined:
    Dec 12, 2011
    Posts:
    32
    @ShikenNuggets solution worked for me as well! Many thanks.. I could turn it back to 2.0 subset again and it still works :)
     
  12. jschroyen

    jschroyen

    Joined:
    Aug 19, 2015
    Posts:
    22
    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.
     
  13. LHAppri

    LHAppri

    Joined:
    Aug 18, 2017
    Posts:
    10
    I was running, had a breakpoint on Update() with nothing being hit so I came here looking for help. Saw @ShikenNuggets solution & went in to check the setting. Changed it to .Net 2.0 while running & the breakpoint hit immediately!
     
  14. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    703
    Mine was already on .NET 2.0, I started the game up, changed it to subset, then changed it back and it started working.
     
  15. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    623
    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.
     
    Last edited: Sep 6, 2018
    nsfnotthrowingaway likes this.
  16. nsfnotthrowingaway

    nsfnotthrowingaway

    Joined:
    Feb 18, 2016
    Posts:
    44
    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?
     
  17. EthanFischer

    EthanFischer

    Joined:
    Feb 10, 2016
    Posts:
    8
    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
     
    Last edited: Nov 7, 2018
  18. nsfnotthrowingaway

    nsfnotthrowingaway

    Joined:
    Feb 18, 2016
    Posts:
    44
    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.
     
    Last edited: Nov 13, 2018
  19. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    262
    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.
     
    kcup024 likes this.
  20. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    703
    I switched to using JetBrains Rider about a year ago, never had an issue since.
     
  21. kcup024

    kcup024

    Joined:
    Nov 25, 2018
    Posts:
    3
    Using partial classes with 2018.3.4f1. THIS is the only thing that helped within this thread (in my case).