Visual Studio integration is pretty busted

Hello

I've been working with the alpha for some time now and pretty much through the entirety of that time, Visual Studio and Unity has not been working nice together at all. Am I the only one with these problems? I would've thought someone else would've posted it by now, but I guess not.

To start, clicking ANY Debug.Log message fails 99% of the time. If I get an error in the console I can't click on it because it will open up in my default text editor instead and Visual Studio will be prompted to reload the project several times.

Creating a new script in Unity prompts VS to reload again, but even after reloading it feels like a 50/50 chance it will open in VS or the default text editor if I click on it inside Unity. So I have to create the script then go to Visual Studio and fish it out of my project browser.
Creating a script inside Visual Studio though breaks it even more. I can create a script, edit it, and all that, but as soon as I go into Unity and it does it's thing, Visual Studio seemingly loses all references. All my connected assembly definitions are lost and I have to restart Visual Studio to get it back.

Lastly, a problem that I don't know if it's directly related to Unity + VS but I thought I should just mentioned it anyway. The Visual Studio integration package is one massive thorn in my side. Since I've been encountering other bugs I've been deleting the Library folder quite often. In there, in the package cache, that package has a "vswhere.exe" file that is ALWAYS locked somehow. I can't delete it normally and has to resort to programs like Unlocker sometimes, BUT EVEN THAT can fail. This also stops me from reporting bugs because the bug reporter also has a problem with it. I have to restart my PC every time I do it which I'm not quite fond of.

I don't know if it has something to do with me using a preview version of Visual Studio 2019 but it works fine in older Unity versions like 2019.3 and 2020.1. I find it odd that no one else has mentioned this... I can't be the only one, right?

I also don't know quite how to report bugs like this and therefore I haven't reported any of it.

small rant over

4 Likes

I have the exact same problems, but I'm using 2021.1 beta. I think it started around beta 4 once I upgraded to the latest package of VS.
One thing I found to help it a little bit is to go to editor preferences -> external tools and force Unity to use a specific version of VS. It doesn't solve it completely but it does synchronize more like that

1 Like


No, I'm experiencing all of those problems, too.

1 Like

I do like the new change on Unity VS package 2.0.1 where you can choose which projects to include on the solution, this has never worked properly before for me but now it's pretty robust.

What fails for me every second time though is when I double click the error on console or file in the editor, it often only loads individual file in VS instead of the whole solution. I then have to close VS and try it again and it opens it properly on the second time. On the first time when it fails, it doesn't have any refs without the solution so editing the file it pretty busted as there's no functional intellisense (until I reload the file again and it opens it along with the solution).

Same issues here. Randomly Unity wants to open scripts in VS 2013 despite VS 2019 being set in preferences and having an instance of it open and ready. I have to click the Regenerate Project Files button all the time and honestly just stopped creating and opening scripts from within Unity, too much of a headache.

Looking forward to a fix.

Same problem here

For what it’s worth, scripts seem to correctly open the solution in Rider.

1 Like

I thought it was just me. I uninstalled VS 2019 and went back to 2017 because of this but that didn't really fix it. I have to regenerate files every time when I open Unity, but even then things end up breaking randomly after a while.

I have a likewise issue. When I open a script by double clicking it within the Unity project view, it opens the script without opening the C# project. Any reference to another class is broken. I can't do anything like this.

The weird thing is that I've been using Unity 2020.2 just fine last week. It just randomly, suddenly, and for no apparant reason broke this morning.

1 Like

Hey @Hertzole and all, Program Manager of Tools for Unity here.

The best way to report issues with Visual Studio so we can fix them quickly is to use the Help > Report a Problem menu from within Visual Studio. From there, you can document the issue and your version information and logs are included automatically. That helps us diagnose.

Would you mind filing a report that way and include as much detail as you can? For example, when you click Debug.Log and it fails, what do you mean by fail?

For everyone else having these issues (or other issues) please report the same way, or add a comment to an existing post that is similar. If you'd prefer to work 1:1, message me on here or on Twitter (@jmillerdev).

1 Like


I'll report my issues as soon as I can! Should I report them all individually or combine most of them?

It's best to report 1 per issue, but I understand that can be a major pain. Whatever you can provide will be a great first step!

A great first step if you're having the issues mentioned in here is to make sure you're using the 2.0.2 version of the Visual Studio package. If you do update to that, and it resolves or not, please let me know!

2.0.1 is the latest version in package manager for me.


I'm going to start collecting some videos on the issues because I believe they may be hard to reproduce if you're unlucky. But I won't report anything until I've tested that new version (which hasn't shown up yet, as Crayz pointed out).

Doh, sorry about that... It's live now.

1 Like

In Edit --> Preferences --> External Tools

5932358--634553--upload_2020-6-2_23-28-7.png

Setting the External Script Editor to Visual Studio and Regenerate project files. Solved the problems for me.

4 Likes

@John_MSFT Why did you make the decision that these fields should be a global configuration and not by project? Maybe in a certain project I want to have more packages in the solution to be able to debug certain code better but not in other projects.

4 Likes


Version 2.0.2 still does not support C# 8. This is a very simple fix, strange it didn't make it on this update.

2.0.2 seems to have fixed the issue of opening the wrong editor. Only issue I've noticed is clicking a script shortly after renaming/deleting/creating another script before assets have had a chance to refresh will open a new instance of Visual Studio.