I founded one solution which might work for all cases.
Just start any version of VS separately from Unity.
Open solution file which is previously generated for project.
Open Unity, and double click on any script. It will be opened in VS and Attach will be there.
Note: I have project in Unity 5 and was working with VS 2017. Sln file is generated by VS 2017. And now on this way I can use VS 2019 and VS 2022 normaly.