Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Visual Studio 2022 debugger attachment no longer works

Discussion in 'Code Editors & IDEs' started by ComeOnAndSam, May 1, 2023.

  1. ComeOnAndSam

    ComeOnAndSam

    Joined:
    Nov 8, 2016
    Posts:
    62
    For about a month most (but not all) scripts can't have the VS 2022 debugger attached to them. The breakpoint appears hollow with a yellow exclamation point and says "This breakpoint will not be hit. Unable to find corresponding location."

    Some scripts this happens and some it doesn't, sometimes it will work on the same script on subsequent debugger attachments, sometimes it breaks on re attachment after working previously, sometimes it never works at all.

    What's the issue and how do I fix it?

    I'm on Unity 2022.2.16 and VS Community 2022 17.5.4
     
    stighy likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,412
    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874

    Anytime you go beyond LTS you are an unpaid test pilot.

    https://forum.unity.com/threads/pro...de-to-new-unity-version.1400491/#post-8812384
     
  3. ComeOnAndSam

    ComeOnAndSam

    Joined:
    Nov 8, 2016
    Posts:
    62
    Yeah I couldn't get any package/ VS based fixes to work, so Im thinking it might just be the unity version. 2022.2.17 has been working so far.
     
  4. ComeOnAndSam

    ComeOnAndSam

    Joined:
    Nov 8, 2016
    Posts:
    62
    Aaaand nevermind. Can't debug anymore.

    There were too many fundamental changes from 2022 to 2021, I don't have any way to downgrade. I need a way to make this work, none of the methods linked fix it.
     
    Last edited: May 1, 2023
  5. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    1,021
    I've been having the same problem with Unity 2022 ever since it went LTS. I can no longer use Visual Studio's debugger. This has been a severe problem in the past and it seems to crop up with every few releases of Unity.

    Long story short if you are working in Unity then you are working with an outdated and half-baked version of C# in a methodology that would make any dev from the 1980's feel right at home. Get good at logging because it's the only debugging tool that has ever reliably worked with Unity.
     
    stighy and Stranger-Games like this.