Search Unity

multiple instance of visual studio

Discussion in 'Editor & General Support' started by wouter_vugt, Sep 21, 2020.

  1. wouter_vugt

    wouter_vugt

    Joined:
    Feb 25, 2015
    Posts:
    129
    Everytime I try to edit a script, it opens in a new visual studio version...
    Mac, Unity2020.1.5f1

    Deleting the snl file does not solve this.
    Happens after updating to this new unity version..
     
  2. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @wouter_vugt,

    First, check that the Visual Studio Editor package is updated. Check in Windows > Package Manager of the Unity Editor to update this.

    Also make sure that VS for Mac is set as the external editor in the Unity Editor > Preferences > External Tools window.

    If the issue continues after that, please use the Help > Report a Problem menu from Visual Studio for Mac and file the issue so our team to can look into it. Thanks!
     
    Sab_Rango, biroroapp and questalot like this.
  3. wouter_vugt

    wouter_vugt

    Joined:
    Feb 25, 2015
    Posts:
    129
    well that doesn’t work, still happening..
    will make a bug report..

    Gotta say it is almost impossible to code with this bug, so hopefully there is a quick fix fo this..
     
  4. Poccade

    Poccade

    Joined:
    Sep 5, 2019
    Posts:
    1
    I was able to fix this by going to Package Manager and then removing the two Visual Studio packages (Visual Studio Editor & Visual Studio Code Editor) which were originally added automatically. New everything runs just fine on Catalina with Unity and it never opens multiple instances of Visual Studio.
     
  5. tomcarnevale

    tomcarnevale

    Joined:
    Dec 26, 2019
    Posts:
    6
    Mine worked by removing the Visual Studio Editor but only after restarting Unity.
     
    Dahshat and qualias like this.
  6. Milluz

    Milluz

    Joined:
    Oct 22, 2014
    Posts:
    9
    Last edited: Oct 29, 2020
  7. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @Luiz-Aoki

    Sorry for the confusion - the issue with multiple instances of Visual Studio for Mac opening is fixed and will be released in the next version of the Visual Studio Editor package.
     
    Mike-Church, Golesy and Milluz like this.
  8. Mike-Church

    Mike-Church

    Joined:
    Apr 9, 2013
    Posts:
    4
    And when will that be, please?

    I have spent hours trying to use/configure VS Code or just trying to get VS running with the spawning of multiple editor instances.
     
  9. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    quadrohead and Milluz like this.
  10. questalot

    questalot

    Joined:
    Apr 18, 2020
    Posts:
    1
    Had the same issue and updating the Visual Studio Editor package fixed it for me.
     
  11. biroroapp

    biroroapp

    Joined:
    Jan 24, 2020
    Posts:
    2
     
  12. wouter_vugt

    wouter_vugt

    Joined:
    Feb 25, 2015
    Posts:
    129
    Hey guys, a little bit later, but just wanted to say it works now with the update!
    I went back to 2019, but really wanted to use the serializable generics in 2020, so I switched back, looked for this bug again, and it was solved, awesome!
     
    John_MSFT likes this.
  13. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    Unity 2020.2.0f1 with Visual Studio Editor package v2.0.5

    It appears to still be happening
     
  14. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @wildertony

    To confirm, VS for Mac or VS on Windows?

    Either way, please use the Report a Problem menu in VS/VS for Mac to file a bug so we can investigate. Thanks!

    The known issues were fixed in 2.0.5, so if it's still happening on Mac, it could be something new.
     
  15. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    @John_MSFT

    Ah right, VS on Windows 10 :D

    I'll watch out for it and report it when I see it again
     
  16. MrPaparoz

    MrPaparoz

    Joined:
    Apr 14, 2018
    Posts:
    157
    I can confirm it for macOS Big Sur with 2020.2.01f.
     
  17. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    it looks to me to be an issue with opening scripts from Unity during any kind of compilation, or during a dialogue popup (specifically, the reload solution popup) within Visual Studio
     
  18. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @MrPaparoz Interesting... Please double-check you have version 2.0.5 of the Visual Studio Editor package installed in the project using the Unity Package Manager.

    If it continues, please use the Help > Report a Problem feature in VS for Mac to submit a bug and share as much detail as you can on how to reproduce it.

    @wildertony, if there is any dialog open in Visual Studio, this will happen - it's a known issue, unfortunately. When a dialog is open in VS, the communication between VS and Unity is blocked/unknown so a new instance is launched.

    However, you shouldn't see too many solution reload dialogs these days - what are you doing in the project that causes the dialogs? We might be able to optimize that scenario and prevent this. Thanks!
     
  19. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    Seems like most changes to the codebase will cause the reload dialogue to appear. Renaming or moving scripts are probably the biggest offenders
     
  20. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    173
    Same issue here on windows
     
  21. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @wildertony Hm, that surprises me. Please do take advantage of the Report a Problem tool so we can get exact version numbers, etc. We'll investigate.

    @ZhavShaw Please also report the issues you're seeing so we can investigate. Thanks!
     
  22. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    In the time we started talking about this, I've actually switched to VS Code because the issue takes up so much of my time hahaha. I'll let you know if I come across the issue again next time I use VS
     
    ROBYER1 likes this.
  23. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    @John_MSFT It appears to be most common when I'm opening script files from within packages.
     
    John_MSFT likes this.
  24. GalopeTeam

    GalopeTeam

    Joined:
    May 13, 2014
    Posts:
    8
    After two days trying to fix this issue, only one thing finally did the fix. I've tried to exclude the. Sln and .Csproj files, regenerate new .Csproj by External Tools tab, update the VS and all packages, download/update or remove some extensions, change paths and anything you can find on the forums. So, I decided uninstall 2019 and roll back to 2017.

    I opened the unistaller and just for a last try, I managed to do a repair run and see what happens. After 1gb of download and some minutes repairing, for my surprise works perfectly fine, no more new instances when open a new file.

    For short, try repair via "Visual Studio Installer".
     
  25. mityo1234

    mityo1234

    Joined:
    Aug 14, 2020
    Posts:
    1
    Thank you very much ! This solve my problem !!
     
  26. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Having this issue constantly on my mac workstation, on the windows 10 machine visual studio works perfectly as expected. MacOS with unity, not so much
     
  27. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    Sorry for the issues! We did recently fix several issues that caused. Would you make sure that VS for Mac is up to date? If you're using Unity 2020 or higher, please also make sure that the Visual Studio Editor package is updated to version 2.0.7 or newer using the Unity Package Manager via Unity > Windows > Package Manager.

    If you still have the issue after that, it could be a bug that we need to fix. In that case, please use VS for Mac > Help > Report a Problem to file the bug so we can investigate quickly. Thank you!
     
  28. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I can confirm I have all those, this is also a brand new mac, new project, using Unity 2020.3.0f1 fresh installs and all editor settings at default other than adding the package for Visual Studio (not vs code) and assigning visual studio as the code editor for the project.

    VS studio is fully up to date also using 8.9.4 build 25 mac community edition with the Visual Studio for Mac Tools for Unity extension v 2.9.3.0

    It's just about a half hour into working between Visual Studio and Unity, I go to open a script either double clicking it form the project window or from the component it is on a gameobject, the Visual studio window opens up with the last few scripts I had open, but not the one I wanted to open there. I close the open scripts and leave the window open, try to open the script the same way again and the empty Visual Studio window opens up again, nothing loading.

    Issue persists until I go to regenerate the project files in the Unity preferences, or close/reopen unity or Visual Studio.

    This happens all day while I am working on this mac and it's driving me nuts. I will report it as a bug soon
     
  29. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    After further investigation, this was reproducible on various 2020 Unity versions in any kind of project even a brand new project.

    Can I send the problematic Unity project with the bug report to help?
     
  30. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    Yes, that will help. Thank you!
     
  31. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I'll ping over a repro project this weekend for you as this issue is affecting every other mac user in our team on other macs and it's just getting more irritating. You genuinely need to be working on a Unity project for at least an hour just saving scripts making changes to code and hitting play mode/exit play mode a few times so I will take note of what I do from start to 'scripts not opening in Visual Studio'

    I am planning to move to using VS Code on the mac for a while until this bug is fixed although VS Code on mac had some horrendous issues with getting intellisense to start up so I could use peek references etc.

    This stuff just 'works' instantly on Windows 10 off the bat but on Macs both Visual Studio 2019 and VS Code have some real issues.. not sure if on purpose or not ;) I would prefer to work on windows too but I have to use the mac for IOS builds sadly :confused:
     
  32. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I am looking into how to reproduce this now as it often happens an hour or two into the day while I am working I may have to find a way to send a stripped out working project to you without anything confidential in it.

    I did see another forum user talking about this same issue in a bit more detail than me here:
    https://forum.unity.com/threads/visual-studio-for-mac-issues.1014223/
     
  33. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I am putting the bug report as we speak I just found how to reproduce it and it was very simple actually - I have made a video and steps below as well as highlighting another issue:

    I was actually shocked when I went to report this issue I saw at least 10 copies of this issue all closed due to 'not enough info' and I was able to reproduce it and video it in about 10 minutes today when I spent some time on it. Some of the issues are over 365 days old too!



    Issue 1: Visual Studio on Mac for Unity refuses to open scripts from Unity if you have closed/reopened it while working in Unity :confused:

    Microsoft bug link: https://developercommunity.visualstudio.com/t/Visual-Studio-on-Mac-for-Unity-refuses-t/1395151

    1. Open Unity, make sure Visual Studio is set as the editor default script editing program and package manager install Visual Studio package also the latest version.
    2. Open a script, edit and save script
    3. Close Visual studio
    4. Make a new script in the unity project
    5. Double click on that new script (or any other perhaps)
    6. Visual studio opens, try double clicking other project scripts, they do not open

    I really hope this bug can be fixed soon as it seems to also happen under another condition I have not found yet as very rarely during the working day do I actually close Visual Studio - unless in this case it is happening when I open another Unity project at the same time so I have two open, then in that case it probably is the same as closing Visual Studio.



    Issue 2:
    On Mac the behaviour of Visual Studio with Unity is quite different to windows as with windows if I open 2 Unity Projects, I can have two Visual Studio instances. On Mac, I seem to only be able to have one instance of Visual studio so when editing scripts in multiple open unity projects, visual studio for mac sort of open/close/resets itself between switching between those 2 projects and that is where I also noticed this bug with scripts not opening in Visual Studio for mac. o_O

    Microsoft bug link: https://developercommunity.visualstudio.com/t/No-way-to-have-a-new-instance-of-Visual-/1395152

     
    Last edited: Apr 10, 2021
  34. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Just to update here if anyone else has this issue where Visual studio doesn't open a new instance per project open on Mac OS or if you close and reopen Visual Studio while a project is open then find it doesn't open scripts anymore. The issue is with Unity hubs ruining Visual studio's connection to apple events:

    The workaround is to open Unity without its processes being re-parented on the Hub.

    You can achieve it like this in the terminal:

    /Applications/Unity/Hub/Editor/2020.3.1f1/Unity.app/Contents/MacOS/Unity -debugHub
     
    John_MSFT likes this.
  35. BrainAndBrain

    BrainAndBrain

    Joined:
    Nov 27, 2014
    Posts:
    115
    This is an issue with a variety of text editors on the Mac—I've run into it with both Sublime Text and Nova. it seems like @ROBYER1 may be on to something here with the connection to the Unity Hub.

    Unity, any update on this?

    Thanks!
     
  36. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    ZhavShaw likes this.
  37. potatokiller234

    potatokiller234

    Joined:
    Aug 29, 2018
    Posts:
    2
    This is a fix if you are on windows. You must install in the visual studio modifier package .NET development for C# and Game development with Unity. This will fix that issue
     
    ROBYER1 likes this.
  38. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    Do you have a link for this, the last version of the Visual Studio Editor plugin for Unity that works for me is 2.0.7. Anything after that does not work when double-clicking a script file.
     
  39. MooveXavi

    MooveXavi

    Joined:
    May 21, 2021
    Posts:
    1
    Hey John, your team reintroduced the bug. Latest unity, latest vs studio for mac.
     
  40. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    Please report via Help > Report a Problem. Thanks!