I’ve set up the incremental compiler (as per Unity Incremental C# Compiler - deprecated ) 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)
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 This document is opened by another project or 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 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
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).
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.
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.
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.’