Cannot set Visual Studio breakpoints in embedded package code in Unity 2022.2

After upgrading to Unity 2022.2.12 (from 2021.3.15), I can no longer use VS2022 breakpoints in script code from an embedded package. I can successfully attach the debugger, but when I set the breakpoint, it appears as a hollow red circle. When hovering the hollow breakpoint, it shows the message "The breakpoint will not currently be hit. Unable to find a corresponding location."

This only happens for code in embedded packages (i.e., packages in the project's "Packages" folder). Breakpoints work perfectly fine for all script code in the project's "Assets" folder.

This problem does not occur in Unity 2021.3.15. I verified this by reverting the project back to 2021.3 and successfully hitting breakpoints in embedded packages.

I'm using the latest version of Visual Studio 2022 Community edition (v 17.5.33516).

Several other people have reported this same bug in other Unity forums:

I think there’s an issue with the socket in between. I hit the same issue with another project where I develop the code in an embedded package, only this time, contrary to the post in the other thread, there was no conflict in the manifest. Also this time, the breakpoints were in the Editor assembly.

I noticed that at times VS struggled to attach or even after attaching it stated blocking. Stop Debugging Session took long and sometimes even threw the popup for forcefully stopping it.

Once I tried closing VS and reopening (as they mention in the Known Issues section of the Tools for Unity) and it managed to reattach itself and the breakpoints worked. Another time, it broke into the point I wanted it once, then I stopped the session to fix something and all subsequent tries failed for some reason.

At any rate there seems to be an issue indeed, at the very least when it comes to the treatment of embedded packages.

I have a submitted a Unity bug report for this. Case # is IN-36580.

@beevik : Can you link the bug report because I have no idea how to look it up using the case #.
Issue Tracker does not show it, not with case # nor keywords.

Also this is not just about embedded packages but also unity registry ones. Tried to use breakpoints in ShaderGraph trying to make sense of some graph code but breakpoints are disabled with the same “unable to find corresponding location” message.

I was not given a public-facing bug ID or issue tracker link. This is the response I received:

Your bug report Breakpoints are not working in embedded packages when using Visual Studio has been confirmed and transferred to the appropriate internal development team at Unity. Your bug report has the following internal ID: UUM-31871

Can you try to verify on your end you see the same behaviour for unity packages as well and update the bug report?!

Running into the same thing with Rider.

I used to be able to set breakpoints and step into packages. But now I can’t do either one of those.

If I set the breakpoint INSIDE the package, Rider tells me “Didn’t find the associated module for the breakpoint

If I set the breakpoint OUTSIDE of the package, and try to step into a method that’s in the package, Rider puts me into an arbitrary other file.

EDIT: I fixed it by generating .cjsproj files for Unity Packages:

1 Like

Unity has updated my bug ticket status with the following:

Your bug report IN-36580: Breakpoints are not working in embedded packages when using Visual Studio has been closed with the resolution Won't Fix. Resolver: Resolution Notes: Already fixed in upcoming 17.6 version of Visual Studio

So hopefully the problem will be fixed once the new update of VS2022 comes out.

EDIT: I just downloaded the preview version of VS2022 17.6 and confirmed that breakpoints do in fact work on embedded packages now. I also tested breakpoints in Unity packages, which worked.


I’ve always had all of those checkboxes checked, it makes no difference

1 Like

Exactly, you don't need all of those checked unless you're targeting a package that uses that method, or want their code to show up in the VS solution for ease of access for reading code.

My packages were all embedded (e.g. package exists in Packages folder and gets autolinked to manifest).
Now I also have git url packages so I'll have to check Git Packages to be able to step into them.

But at any rate, Embedded which is my main issue, is checked by default in all projects and mostly does not work.

I hope 17.6 actually fixes the issue as @beevik says.

PS: Checking them all is actually not a good idea. You're making your solution heavy for no good reason and used to be (not sure if still holds) in 2017 or 2018 cycle that Assets->Open C# Project regenerated the solution, so longer times. It's better to keep most of them unchecked until you need them.

UPDATE: 17.6 indeed fixes the issue, although I will keep an eye on it over time. Even before it worked once in a while.

After searching, can confirm that updating to 17.6 of VS2022 solved the issue for me too.


I'm using Unity 2022.3.20 and Visual Studio 2022 version 17.9.2 and I just ended up here after hitting that same issue. Can't step into packages code, and can't put breakpoint in them.

Edit: okay maybe i'm misunderstanding something aboutNuGet, it's actually only for packages that are installed through NuGet. Packages installed through the package manager are working fine.

Yes Yes!!!

Please use the like button to show appreciation instead of necro posting.
Thread locked