Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 753
Thaoden Avatar asked Apr 26 '18 09:04

Thaoden


2 Answers

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.

like image 74
Thaoden Avatar answered Oct 14 '22 11:10

Thaoden


In my case, the problem was occurring in a particular assembly. When we looked at the assembly information, (from the Solution Explorer, right click on project, select Properties, then click on Assemble Information), it was all blank.

So we gave it a Guid, then re-built and it worked.

like image 43
newbi Avatar answered Oct 14 '22 11:10

newbi