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

Debugging woes: "This document is opened by another project"

Discussion in '2018.2 Beta' started by pbdot, May 2, 2018.

  1. pbdot

    pbdot

    Joined:
    Apr 2, 2018
    Posts:
    5
    I've set up the incremental compiler (as per https://forum.unity.com/threads/unity-incremental-c-compiler.523993/) in order to use C# 7 features, but for some reason I cannot debug anything. When I "attach to unity and play", the code runs, but all my breakpoints disappear. If I try to set a breakpoint while debugging, I get a popup message saying "This document is opened by another project", and upon clicking "OK" a few times I sometimes (but not always - doesn't seem to be deterministic) get a "Frame not in module" page.

    My build settings are as follows:
    • Scripting Runtime Version: .NET 4.x Equivalent
    • Scripting Backend: Mono
    • API Compatibility Level: .NET Standard 2.0 (also tried with .NET 4.x)
    Screenshot:


    Things I've tried: Cleaning the project, restarting my computer.

    Any ideas?
     
    Last edited: May 3, 2018
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
  3. dstilwagen

    dstilwagen

    Joined:
    Mar 14, 2018
    Posts:
    36
    I'm getting the same issue. I've tried it in both VS 15.6.7 and VSTU 3.6.0.5 and VS 15.7 Preview 5 and 6 with VSTU 3.7.0.1. I've also tried in both Unity 2018.1.0f2 and 2018.2.0b2 with the same issue. I've also tried different package versions for the incremental compiler and I get the error
    Code (csharp):
    1. This document is opened by another project
    or
    Code (csharp):
    1. The Incremental Compiler has stopped working.
    The second one seems to happen when I use package 0.0.38 and 0.0.39 which gives
    Code (csharp):
    1. Error "csc.exe" exited with code -532462766. Assembly-CSharp
    This may be an issue with VS since I can build and debug in Rider 2018.1
     
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    In that case please report the issues at https://developercommunity.visualstudio.com/.
     
  5. dstilwagen

    dstilwagen

    Joined:
    Mar 14, 2018
    Posts:
    36
  6. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Hi @pbdot, it's working as expected on my side (VS 15.7, Unity 2018.1.0f2), with a simple project.

    - Could you double check that you have .NET targeting packs 4.6 and 4.7.1 installed ?
    - Could you share your project with us ? vstusp[at]microsoft[dot]com

    Thank you!
    Regards
    Sebastien Lebreton [MSFT]
     
  7. pbdot

    pbdot

    Joined:
    Apr 2, 2018
    Posts:
    5
    Yes, both targeting packs are installed. And sure, I'll send it.
     
  8. pbdot

    pbdot

    Joined:
    Apr 2, 2018
    Posts:
    5
    I have both of those installed. I'm running VS Professional 2017 version 15.6.4 and just installed VSTU 3.6.0.5. The "This document is opened by another project" popup message stopped disappearing, but all breakpoints still fail ("The breakpoint will not currently be hit. Unable to find a corresponding location"). Previously I was running the latest release version of VSTU (i.e. not the [experimental] version).
     
  9. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    If Visual Studio is unable to find a source location for a specific breakpoint you will see those warnings. Check that the behaviour you are using is properly loaded/used in the current Unity scene. Unity is only loading types effectively used, so if you don't attach/instantiate your behavior, it will never be loaded, so we'll never be able to bind a breakpoint on this type.

    Sometimes for advanced constructs (like coroutines), we can still display a warning even if everything is fine (because a compiler-generated type will be loaded on first use). We'll probably remove those warnings in a future version.

    Regards
    Sebastien Lebreton [MSFT]
     
  10. pbdot

    pbdot

    Joined:
    Apr 2, 2018
    Posts:
    5
    Sorry, I must have accidently removed the behaviour script from the only gameobject I have. When I reattached it, the "This document is opened by another project" popup message reappeared.
     
  11. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    Hi,

    I tried your project and everything is working as expected on my side.

    So going forward, what you could try is the following:
    - Upgrade to VS 15.7 (final released today!)
    - Remove Library, obj, .vs folder + generated csproj, rsp and sln files in the root folder

    Regards
    Sebastien Lebreton [MSFT]
     
  12. pbdot

    pbdot

    Joined:
    Apr 2, 2018
    Posts:
    5
    I did what you suggested, still getting the same error/problem. Also upgraded to 2018.2.0b3 with no improvement.

    Edit: I tried changing the incremental compiler version in the manifest.json file to "0.0.38" (from 0.0.30), and now I'm getting the following error: '"csc.exe" exited with code -532462766.'
     
    Last edited: May 11, 2018