-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Internal error in the C# compiler" when try to evaluate statement in Watch\Immediate window #18273
Comments
FYI, I've also hit a similar issue but a different call stack when debugging a .NET Core app with embedded PDBs: Exception:
Stack trace:
|
@brettfo That seems unrelated. Could you please file a separate bug? |
It seems my error stemmed from the fact I was debugging a project on Mac under Parallels desktop and the project wasn't located on the windows' C:\ drive. Still the error could be much clearer. |
@brettfo Do you have a repro or a crash dump? |
Repro unit test: [Fact, WorkItem(18273, "https://github.com/dotnet/roslyn/issues/18273")]
public void CapturedLocalInNestedLambda()
{
var source = @"
using System;
class C
{
void M() { }
}";
var compilation0 = CreateStandardCompilation(source, options: TestOptions.DebugDll);
WithRuntimeInstance(compilation0, runtime =>
{
var context = CreateMethodContext(runtime, "C.M");
var testData = new CompilationTestData();
context.CompileExpression("new Action(() => { int x; new Func<int>(() => x).Invoke(); }).Invoke()", out var error, testData);
Assert.Null(error);
testData.GetMethodData("<>x.<>m0").VerifyIL("");
});
} |
@cston Could you take a look? The variable |
This looks a lot like a Watson we are tracking https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=403646&_a=edit&triage=true |
@jaredpar I don't have access to your link :( I am consistently having the problem debugging https://github.com/gitextensions/gitextensions project - both on my Windows PC and running under Parallels on Mac. Both VS2015 and VS2017. Is there a way to find more information on what fails/why the error occurs? |
Unfortunately that link can't be accessed except by MSFT employees. It represents a Watson crash of the bug. I added it here so we can track both issues together. Don't have more details yet as we are still digging into this. |
@RussKie This error occurs when the expression being evaluated contains nested lambdas where the inner lambda closes over a local declared in the outer lambda. |
Possibly related to #19257 |
@tudor-turcu, thanks for reporting an additional failure. The original bug should be fixed, so you may be hitting a distinct issue. Please consider opening a new issue with a simple example that hits the error. Thanks. |
Version Used:
Microsoft Visual Studio Enterprise 2017
Version 15.0.26228.9 D15RTWSVC
Microsoft .NET Framework
Version 4.6.01586
Project target framework:
.NETCoreApp 1.1
.NET Framework 4.5.2
Steps to Reproduce:
Run the program and put a break point in the start of method "Main"
When break point hit, paste the following statement in Watch window or in the Immediate window:
Expected Behavior:
"1" will printed
Actual Behavior:
"Internal error in the C# compiler" printed
StackTrace:
"The given key was not present in the dictionary."
The text was updated successfully, but these errors were encountered: