问题
Test Explorer allows to run tests under debugger and I use it quite often for debugging single tests. However debugger settings used in this case are different from that set for the test project and prevent efficient debugging. I would like to limit debugging to managed mode only for UWP class library while debugger starts always in mixed native/managed mode. This prevents any debugging as .NET Core does not support mixed mode debugging. I work on VS 2015.
After checking and testing all possible settings I have failed to switch debugging mode from mixed to managed only. Any ideas?
Not solved: cleanup and rebuild of MEF cache resolved problem for a short time.
Debugging fails with error msg Unable to attach to CoreCLR. Interop debugging is not supported
回答1:
The above problem is most probably a bug or debugger/coreclr mismatch in Windows runtime. With UWP runtime version 5.1.0 debugging in managed, native and mixed mode works perfectly. By updating UWP runtime version to 5.2.2 one can reproduce reported problem. By downgrading to UWP runtime 5.1.0 problem is resolved. Version of my VS is 2015 Update 3.1.
All the above problems were reproduced on clean Windows 10 Pro and VS 2015 Update 3.1 install.
See comment 2 for workaround for UWP runtime v5.2.2
回答2:
To expand on Jacek Blaszczynski's answer, I had to add Microsoft.NETCore.Runtime.CoreCLR version 1.0.4 nuget package to make it work with Microsoft.NETCore.UniversalWindowsPlatform version 5.2.2. Interestingly, I was unable to use the current version 1.1.0. It would not even get installed.
As an alternative to MS Test I suggest using xUnit. It also works with UWP, does not require adding Microsoft.NETCore.Runtime.CoreCLR nuget package and runs much faster. Here is a quick tutorial.
回答3:
Interop debugging is not supported means that you cannot debug both managed and native code types at the same time. For CoreCLR apps, use the attach to process and enable CoreClr, debug it again.
来源:https://stackoverflow.com/questions/39399907/how-to-change-debugger-settings-for-debugging-individual-unit-tests-from-vs-2015