VS 2017 immediate window shows "Internal error in the C# compiler"

Thaoden picture Thaoden · Apr 26, 2018 · Viewed 8.4k times · Source

I use Visual Studio 2017 (15.6.6). When debugging, I try to evaluate simple expressions like int a = 2; in the immediate window. An error

Internal error in the C# compiler

is thrown.

I tried to enable Use Managed Compatibility Mode as hinted at in this question but it didn't help.

Thanks for any help.

Answer

Thaoden picture Thaoden · Apr 26, 2018

Searching further I found this issue on GitHub where an answer recommends to also check Use the legacy C# and VB expression evaluators. Visual Studio gives me a warning about checking this option, but turning this on I can evaluate expressions in the immediate window again.

It is even possible to turn off the Use Managed Compatibility Mode again.

Update: Notice though that using the legacy expression evaluators prevents me from inspecting local variables at debug time, so I wouldn't call it a solution.