Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

The "Attach to Unity" button disappears from VS 2015.

Discussion in '2018.1 Beta' started by georgeq, Jan 23, 2018.

  1. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    I was working with Unity 2018.1.0b3 and I was debugging some code on Visual Studio 2015, everything was fine until suddenly the "Attach to Unity" button disappeared, there was no crash, nor a program restart, nothing unusual it just simply disappeared, and now I see "Start" instead. I tried closing both Unity and VS and restarting them again but that didn't solve the problem. Just after the project finishes loading on VS the "Attach to Unity" button's label is replaced with "Start".

    It seems someone had the same problem with a previous version of Unity, and he seemed to solved it by switching to MonoDevelop and back on the preferences/external tools window, but since Unity 2018 no longer comes with MonoDevelop that's not an option . I tried switching to Visual Studio 2017, but I have exactly the same problem. I don't know how the two programs a linked, but it is pretty obvious that this link breaks just after the project finishes loading.

    atu.png


    I'm trying to solve the problem somehow, so I changed the external script editor to Unity's 2017 MonoDevelop, and when I try to debug the code it shows me this:

    atu2.png

    So I think that process is the root of this problem, however, if open the Windows' task manager I can find such process, so there's no way I can kill it... I'm restating the PC and see what happens.

    ... It seems there's another kind of problem since restarting the computer didn't solve it.

    ... also this seems to affect only 2018, because if I open the project with 2017.3 I don't have this problem.
     
    Last edited: Jan 23, 2018
  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    the team is aware of it, b4 still broken so maybe b5, but at the speed they're pumping out incremental betas, b19 ;)
     
  3. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    try 2018.1.b4 ... I don't have the problem anymore.. for now :)
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I notice a few issues with VS reloading needlessly and closing the open solution on b4 myself.
     
  5. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
  6. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    I uninstalled b3 and then installed b4, but that didn't solve the problem. Moreover, if I create a brand new project with b4 and try to open a newly created script I get this:

    vse.png

    The "Attach to Unity" button doesn't appear, instead there's "Attach..." and if I click it, I get a list of programs which I guess are listening to certain port:

    vse2.png
     
  7. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I do like those bugs that just go away

    No idea why it no work for you in b4.. Am using Stable c#3.5 for the project.. I know that before I was testing with Experimental C#4.5 in the player prefs
     
  8. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Hi

    We investigated with Unity this case where Unity 2018 beta was not properly delegating to VSTU the generation of solution and project files. Because of this, you ended up with a regular C# solution so all VSTU features regarding debugging, wizards, reloading, etc... were disabled in VS.

    It was a registration issue, that was just fixed in Unity beta. We also patched VSTU to be more resilient about those issues.

    We expect the fix to be soon available in Unity beta.

    Regards
    Sebastien Lebreton [MSFT]
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Thanks Sebastien, much appreciated.
     
    Peter77 likes this.
  10. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    According to this: https://unity3d.com/es/unity/beta-download this problem has been solved on b6, but it is not!... I'm still experiencing the same problem, even deleting the solution files and forcing a full rebuild.
     
  11. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Same problem here.
     
  12. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    What are the exact repo steps, could you perhaps report a bug on the issue?

    Does your solution in VS have a project named "Assembly-CSharp" as in the screenshot in the first post in this thread? If so, then VSTU integration was not loaded correctly. If you do not have it, then I think the issue is a different one from the one that was fixed in b6.
     
    laurentlavigne likes this.
  13. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    fix?
     
  14. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    I don't have an "Assembly-CSharp" project instead I have "projectname".CSharp... with a dot instead of an underscore. I don't know if having an assembly definition file affects the naming.
     
  15. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Sounds to me like VSTU integration is loaded correctly to me. To be sure, in the Help Menu in Visual Studio, do you have a "Unity API Reference" ?

    @sailro, @jbevain, can you help get to the bottom of this?
     
  16. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    No I don't have that option, this is what I see on the VS help menu:

    vsh.png

    I just upgraded to b7... and now I'm having a new problem: if I delete the VS solution files, they are not rebuilt automatically when there's an assembly definition file. Now I must delete the ADF in order to get the VS solution rebuilt. I had the same problem with 2017.3.1 (Case 998820), but apparently that was solved on 2018.1.b... however it seems this bug has been reintroduced in 2018.1.0b7, since I didn't had to delete the AD files on previous betas.
     
  17. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    @georgeq, could you please send us your project files here: vstusp[at]microsoft[dot]com.

    + your exact VS, VSTU versions (Help/About VS)

    Thanks!
     
  18. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    I just sent you a project with which hopefully you'll be able to reproduce the problem... if you open this project with Unity 2017.3.1 or 2018.1.0b7 the VS solution files are not rebuilt automatically but this problem does not occur on 2018.1.0b3 though b6. The only possible way to get this files rebuilt automatically to delete all the assembly definition files.

    You will also see that the "Attach to Unity" button (in VS 2015) sometimes changes to "Start" and other times to "Attach to process"...

    Hope this helps...

    Thank you very much!
     
  19. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    So the problem was that VSTU was outdated... I thought this component upgraded automatically every time you install a new version of Unity, but that's not the case, and VS also fails to do the upgrade, so if anyone is having the same issue, make sure you have the latest version... you can download it here.

    Thanks Sebastian!
     
    sailro likes this.
  20. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    This is where the version is, beyond up to date, debug button shows up 25% of the time.

     
  21. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    @laurentlavigne, could you send us a minimal repro project ? We would like to see if some third party package or something like that causes the issue. After the Unity fix, both their QA and ours confirmed that it was fixed.

    vstusp[at]microsoft[dot]com

    Thank you!
     
  22. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Like I said, the problem was solved by upgrading VSTU to version 3.5.0.2... however I had to delete all the VS solution files and get them rebuilt in order to actually be able to debug... Now... definitively there's something wrong somewhere, because I'm having the same problem again. I did this:

    1) I installed the ProBuilder package from the Asset Store and played around with it for a while.
    2) I deleted the package from my Assets folder.
    3) I opened the Package Manager and Installed ProBuilder from there.

    Somewhere between these steps the VS integration was lost.

    I deleted the VS solution files to force a rebuild, but that didn't solve the problem. To recover from that I had to delete everything in my project's folder except Assets, and ProjectSetting.
     
  23. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Interesting, and what is the ProBuilder version you are using ?

    @lukaszunity could this be related to the Package Manager ? Because reading their change log, ProBuilder now runs as package manager module (3.0.1-f.0).
     
  24. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    It seems there are several issues that trigger this bug. Today I was editing 3 projects simultaneously 2 with 2018.1.b7 and other with 2017.3.1f1... I was reviewing some code on the 3 projects so the 3 VS solutions were open, when I switched to one of the 2018 projects VS told me there were changes in the solution files and asked me if I wanted to reload... That was completely unexpected since I hadn't change anything on any of the projects, I was just reading code. I replied "yes" and then, after reloading the "Attach to Unity" button was chanced to "Start"... then I switched to the other 2018 project and VS also told me the solution files on that project had also changed, and again the "Attach to Unity" button disappeared after reloading.
     
    Last edited: Feb 16, 2018
  25. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Is 3.0.1 ----- but the only way I could get back the "Attach to Unity" button was by completely deleting the UnityPackageManager folder.
     
  26. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
  27. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    reload.png

    _postprocessrntime is an Assembly Definition File I created to the replace the original included on the Postprocessing Stack (version 2) ADF, which I deleted in order to be able to rebuild the VS solution. I'm working on my own scripts, I haven't even open a script on the postprocessing folder, and certainly I haven't added nor deleted any scripts to my project, I'm getting this messages at random intervals, I know this is not normal, but don't know if it is a bug or if should I worry about some malware messing up with my files???
     
  28. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    This issue has now been fixed.

    The cause of the issue was that we were not correctly handling the VSTU integration when scripts were added or removed from Unity project. The initial fix in b6 only fixed the issue on startup and not when scripts are added and removed while the editor is running.
     
    laurentlavigne and Peter77 like this.
  29. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Thank you... hope to see it in b8, but there's another issue I'm not sure has been taken into account, the Unity installer is not making sure the latest version of the VSTU is been upgraded, so you can end up with the newest version of Unity running an outdated version of the VSTU.
     
  30. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Not quite sure what's issue that has been fixed, I just upgraded to b8 and the "Attach to Unity" button on VS is still missing.
     
  31. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Fix will be available in Unity 2018.1.0b10
     
    codestage likes this.
  32. codestage

    codestage

    Joined:
    Jul 27, 2012
    Posts:
    1,931
    @lukaszunity Glad to hear this!
    It became pretty annoying lately.
     
  33. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Ok, Thanks!
     
  34. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Just to confirm this problem was solved on b10. Thank you!