Skip to content
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

System.InvalidOperationException from LocalRewriter.TransformCompoundAssignmentLHS #31295

Closed
TessenR opened this issue Nov 21, 2018 · 1 comment
Labels
Area-Compilers Bug New Language Feature - Nullable Reference Types Nullable Reference Types Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@TessenR
Copy link

TessenR commented Nov 21, 2018

Version Used:

Branch C# 8.0: Nullable reference type (29 Oct 2018)
https://github.com/dotnet/csharplang/blob/master/proposals/nullable-reference-types.md
Latest commit 2f8fef by AlekseyTs:
Compare Nullable modifiers while comparing type symbols by default. (#30770)

Steps to Reproduce:

Compile the following code

class C
{
    void M()
    {
        for (var x = 0; ; x!++) { }
    }
}

https://sharplab.io/#v2:EYLgZgpghgLgrgJwgZwLQDk4BstWFiAJQkiQDsBjCAFQE8AHFAHwAEAmAAgGEBYAKADe/DiI4sALBwCyACgCUw0UL6jVHMAHsEHGQDco2gB4cAvBwAMAbg7XDAQgDUDuRwEcAvopGe+7oA==

Actual Behavior:

System.InvalidOperationException: Unexpected value 'SuppressNullableWarningExpression' of type 'Microsoft.CodeAnalysis.CSharp.BoundKind' at Microsoft.CodeAnalysis.CSharp.LocalRewriter.TransformCompoundAssignmentLHS(BoundExpression originalLHS, ArrayBuilder`1 stores, ArrayBuilder`1 temps, Boolean isDynamicAssignment) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs:line 619 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitIncrementOperator(BoundIncrementOperator node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs:line 418 at Microsoft.CodeAnalysis.CSharp.BoundIncrementOperator.Accept(BoundTreeVisitor visitor) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs:line 873 at Microsoft.CodeAnalysis.CSharp.BoundTreeRewriterWithStackGuard.VisitExpressionWithoutStackGuard(BoundExpression node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\BoundTree\BoundTreeRewriter.cs:line 97 at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(BoundExpression node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\BoundTree\BoundTreeVisitors.cs:line 225 at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(Int32& recursionDepth, BoundExpression node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\BoundTree\BoundTreeVisitors.cs:line 206 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitExpressionImpl(BoundExpression node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter.cs:line 201 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitUnusedExpression(BoundExpression expression) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter_ExpressionStatement.cs:line 73 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.RewriteExpressionStatement(BoundExpressionStatement node, Boolean suppressInstrumentation) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter_ExpressionStatement.cs:line 21 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitExpressionStatement(BoundExpressionStatement node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter_ExpressionStatement.cs:line 16 at Microsoft.CodeAnalysis.CSharp.BoundExpressionStatement.Accept(BoundTreeVisitor visitor) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs:line 2875 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.Visit(BoundNode node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter.cs:line 145 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitForStatement(BoundForStatement node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter_ForStatement.cs:line 18 at Microsoft.CodeAnalysis.CSharp.BoundForStatement.Accept(BoundTreeVisitor visitor) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs:line 3421 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.Visit(BoundNode node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter.cs:line 145 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.VisitBlock(BoundBlock node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter_Block.cs:line 23 at Microsoft.CodeAnalysis.CSharp.BoundBlock.Accept(BoundTreeVisitor visitor) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs:line 2485 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.Visit(BoundNode node) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter.cs:line 145 at Microsoft.CodeAnalysis.CSharp.LocalRewriter.Rewrite(CSharpCompilation compilation, MethodSymbol method, Int32 methodOrdinal, NamedTypeSymbol containingType, BoundStatement statement, TypeCompilationState compilationState, SynthesizedSubmissionFields previousSubmissionFields, Boolean allowOmissionOfConditionalCalls, Boolean instrumentForDynamicAnalysis, ImmutableArray`1& dynamicAnalysisSpans, DebugDocumentProvider debugDocumentProvider, DiagnosticBag diagnostics, Boolean& sawLambdas, Boolean& sawLocalFunctions, Boolean& sawAwaitInExceptionHandler) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Lowering\LocalRewriter\LocalRewriter.cs:line 97 at Microsoft.CodeAnalysis.CSharp.MethodCompiler.LowerBodyOrInitializer(MethodSymbol method, Int32 methodOrdinal, BoundStatement body, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState, Boolean instrumentForDynamicAnalysis, DebugDocumentProvider debugDocumentProvider, ImmutableArray`1& dynamicAnalysisSpans, DiagnosticBag diagnostics, VariableSlotAllocator& lazyVariableSlotAllocator, ArrayBuilder`1 lambdaDebugInfoBuilder, ArrayBuilder`1 closureDebugInfoBuilder, StateMachineTypeSymbol& stateMachineTypeOpt) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 1259 at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 1088 at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 498 at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass21_0.<CompileNamedTypeAsTask>b__0() in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 388 at Roslyn.Utilities.UICultureUtilities.<>c__DisplayClass5_0.<WithCurrentUICulture>b__0() in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\Core\Portable\InternalUtilities\UICultureUtilities.cs:line 136 at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers() in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 303 at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean emittingPdb, Boolean emitTestCoverageData, Boolean hasDeclarationErrors, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 144 at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CompileMethods(CommonPEModuleBuilder moduleBuilder, Boolean emittingPdb, Boolean emitMetadataOnly, Boolean emitTestCoverageData, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2626 at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream, Stream metadataPEStream, Stream pdbStream, Stream xmlDocumentationStream, Stream win32Resources, IEnumerable`1 manifestResources, EmitOptions options, IMethodSymbol debugEntryPoint, Stream sourceLinkStream, IEnumerable`1 embeddedTexts, CompilationTestData testData, CancellationToken cancellationToken) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\Core\Portable\Compilation\Compilation.cs:line 2387 at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream, Stream pdbStream, Stream xmlDocumentationStream, Stream win32Resources, IEnumerable`1 manifestResources, EmitOptions options, IMethodSymbol debugEntryPoint, Stream sourceLinkStream, IEnumerable`1 embeddedTexts, Stream metadataPEStream, CancellationToken cancellationToken) in D:\$TC\work\142fd509662c8cdc\!roslyn\sources\dotnet\src\Compilers\Core\Portable\Compilation\Compilation.cs:line 2335 at SharpLab.Server.Compilation.Compiler.<TryCompileToStreamAsync>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at SharpLab.Server.MirrorSharp.SlowUpdate.<ProcessAsync>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MirrorSharp.Internal.Handlers.SlowUpdateHandler.<ExecuteAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at MirrorSharp.Internal.Connection.<ReceiveAndProcessInternalAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MirrorSharp.Internal.Connection.<ReceiveAndProcessAsync>d__12.MoveNext()
@jcouv
Copy link
Member

jcouv commented Jan 30, 2019

This was fixed (by #32850)
I'll add a test to verify and close

@sharwell sharwell added Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented and removed 3 - Working labels Feb 1, 2019
@sharwell sharwell modified the milestones: 16.0, 16.0.P4 Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug New Language Feature - Nullable Reference Types Nullable Reference Types Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

5 participants