Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Problem with breakpoints: The breakpoint could not be bound

Discussion in 'Editor & General Support' started by francismoy, Sep 29, 2020.

  1. francismoy

    francismoy

    Joined:
    Jul 5, 2017
    Posts:
    45
    I'm using Visual Studio for Mac version 8.7.8 (build 4) and Unity 2019.4.10f1.

    I don't know if it's been due to a recent Visual Studio update, but I'm experiencing problems to set breakpoints. When I click the Play button in Visual Studio to build and associate the project to Unity, I get the following message for every breakpoint that I've added:

    Could not insert breakpoint at [path to script file]: The breakpoint could not be bound
    Sometimes (the fewer) I get to execute Unity and the breakpoints work, but most times Unity keeps freezing until I click the Stop button in Visual Studio.

    I have tried to delete the .csproj files so that they're generated at Unity startup, but this hasn't worked. Has anyone experienced this problem? Can you think of a solution?
     
    owlrazum likes this.
  2. cuzner

    cuzner

    Joined:
    Oct 1, 2015
    Posts:
    11
    Happening to me also. I have been trying to get the debugger to work for years. Guess this is hopeless!
    Visual Studio - 8.7.8 build 4 - downloaded today (29-sept-2020)
    Unity - 2020 .1.3f1

    error:
    Could not insert breakpoint at 'blah/blah/blah...': The breakpoint could not be bound


    Worked on the first breakpoint I set. Then I stopped the debugger, made no code changes and then set some more breakpoints (to get more detail) and got the error.
    Why ???

    Tried many different solutions online, Microsoft even says that they have fixed the issue! Obviously not.
     
  3. francismoy

    francismoy

    Joined:
    Jul 5, 2017
    Posts:
    45
    Thing is it's worked for me until recently, but as it's been some time since I last used the debugger, I'm not sure what the cause might be: is it because I updated from Unity 2019.2 to Unity 2019.4? Or is it due to a recent update of Visual Studio? It must be one of these two causes because I haven't changed anything else. I was hoping to get some idea here before undoing updates, if it's at all possible in the case of Visual Studio...
     
  4. dis-s

    dis-s

    Joined:
    Mar 25, 2013
    Posts:
    48
    I tried everything with Unity 2019.2.21f1 - nothing is working on Mac. "The breakpoint could not be bound".

    But I have found some solution: "New function breakpoint" is working! So, you can just set the breakpoint by function name and it's stop the app when this function called.

    P.S. No such problem in Windows - only on Mac OS.
     
    shakenbake444, pbb33 and owlrazum like this.
  5. francismoy

    francismoy

    Joined:
    Jul 5, 2017
    Posts:
    45
    My solution has been moving to Visual Studio Code, where debugging works properly. However, I think Unity (or Microsoft) should work on this, as Visual Studio is probably the most widely used editor for Unity. At least, they should provide hints on whether it's a configuration error on our part as users or it's their responsibility.
     
  6. owlrazum

    owlrazum

    Joined:
    Jun 20, 2020
    Posts:
    5
    I guess it is still a problem now? Because I too can't set breakpoints. Started working on Mac OS Unity recently.
     
    shakenbake444 likes this.
  7. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    239
    Yeah, yet another pain..
     
  8. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    400
    any update on this? it worked for a few days and then broke...
     
  9. jgmakes

    jgmakes

    Joined:
    Jan 10, 2019
    Posts:
    75
    Still? How are people proceeding. Same issue arising in 2021.x LTS
     
  10. BitBull

    BitBull

    Joined:
    May 16, 2022
    Posts:
    2
    Running into the same issue. I'm just trying to learn Unity coming from MonoGame. This is painful. How is one supposed to develop without reliable step-through debugging?
     
  11. BitBull

    BitBull

    Joined:
    May 16, 2022
    Posts:
    2
    OK, I have tried a bunch of stuff. I'm using VS 8.10.23 and Unity 2022.2.0a13.

    - It seems you can set breakpoints once the debugger is attached but not before
    - It does not seem to like setting breakpoints in files that are referenced via symlinks
    - 'New function breakpoint' always seems to work OK.
    - Once you have stopped in a function breakpoint you can set normal breakpoints OK

    I'll be back on this later but that seems to be the way it is for me at the moment, vaguely usable if a world away from the straightforwardness of MonoGame!
     
    saria2022 and RemiSoleil like this.
  12. saria2022

    saria2022

    Joined:
    Aug 11, 2022
    Posts:
    1
    Make sure to write the same code.
     
  13. shakenbake444

    shakenbake444

    Joined:
    Jul 23, 2019
    Posts:
    21
    I can't get VSCODE to stop at breakpoints. I attach to unity editor and it doesn't want to stop at break points? Can you give me any hits on how to set up debugging properly in VSCODE?
     
  14. hexdecc

    hexdecc

    Joined:
    Oct 24, 2014
    Posts:
    141
    issue continue.
     
  15. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    363
    Same problem with JetBrains rider.
    Tried unity 2020 and unity 2022.
     
  16. hexdecc

    hexdecc

    Joined:
    Oct 24, 2014
    Posts:
    141
    rebuild the solution worked for me
     
  17. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    239
    How?
    Debug.Log everywhere :D