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

Visit foreach await info in error scenarios #69573

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented Aug 17, 2023

Fixes #69539.

The assert was:
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.5+1caef2f33e (64-bit .NET 7.0.10)
[xUnit.net 00:00:06.20]   Starting:    Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests
[xUnit.net 00:00:07.02]     Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics.NullableReferenceTypesTests.ForEach_26 [FAIL]
[xUnit.net 00:00:07.02]       System.InvalidOperationException : Did not find Microsoft.CodeAnalysis.CSharp.BoundAwaitableValuePlaceholder `` in the map.
[xUnit.net 00:00:07.02]       Stack Trace:
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\Test\Core\ThrowingTraceListener.cs(26,0): at Microsoft.CodeAnalysis.ThrowingTraceListener.Fail(String message, String detailMessage)
[xUnit.net 00:00:07.02]            at System.Diagnostics.TraceInternal.Fail(String message, String detailMessage)
[xUnit.net 00:00:07.02]            at System.Diagnostics.Debug.Fail(String message, String detailMessage)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(69,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.VerifyExpression(BoundExpression expression, Boolean overrideSkippedExpression)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(76,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.VisitExpressionWithoutStackGuard(BoundExpression node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\BoundTree\BoundTreeVisitors.cs(212,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.VisitExpressionWithStackGuard(Int32& recursionDepth, BoundExpression node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(91,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs(9846,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeWalker.VisitAwaitableInfo(BoundAwaitableInfo node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs(2123,0): at Microsoft.CodeAnalysis.CSharp.BoundAwaitableInfo.Accept(BoundTreeVisitor visitor)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\BoundTree\BoundTreeVisitors.cs(151,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(93,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(136,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.VisitForEachStatement(BoundForEachStatement node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs(3967,0): at Microsoft.CodeAnalysis.CSharp.BoundForEachStatement.Accept(BoundTreeVisitor visitor)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\BoundTree\BoundTreeVisitors.cs(151,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(93,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\BoundTree\BoundTreeWalker.cs(22,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeWalker.VisitList[T](ImmutableArray`1 list)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs(9934,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeWalker.VisitBlock(BoundBlock node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs(3220,0): at Microsoft.CodeAnalysis.CSharp.BoundBlock.Accept(BoundTreeVisitor visitor)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\BoundTree\BoundTreeVisitors.cs(151,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(93,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs(10635,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeWalker.VisitNonConstructorMethodBody(BoundNonConstructorMethodBody node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Generated\BoundNodes.xml.Generated.cs(8591,0): at Microsoft.CodeAnalysis.CSharp.BoundNonConstructorMethodBody.Accept(BoundTreeVisitor visitor)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\BoundTree\BoundTreeVisitors.cs(151,0): at Microsoft.CodeAnalysis.CSharp.BoundTreeVisitor.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(93,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.Visit(BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.DebugVerifier.cs(39,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.DebugVerifier.Verify(ImmutableDictionary`2 analyzedNullabilityMap, SnapshotManager snapshotManagerOpt, BoundNode node)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.cs(1500,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.AnalyzeWithSemanticInfo(CSharpCompilation compilation, Symbol symbol, BoundNode node, Binder binder, VariableState initialState, DiagnosticBag diagnostics, Boolean createSnapshots, Boolean requiresAnalysis)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\FlowAnalysis\NullableWalker.cs(1453,0): at Microsoft.CodeAnalysis.CSharp.NullableWalker.AnalyzeAndRewrite(CSharpCompilation compilation, Symbol symbol, BoundNode node, Binder binder, VariableState initialState, DiagnosticBag diagnostics, Boolean createSnapshots, SnapshotManager& snapshotManager, ImmutableDictionary`2& remappedSymbols)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs(1852,0): at Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(MethodSymbol method, TypeCompilationState compilationState, BindingDiagnosticBag diagnostics, Boolean includeInitializersInBody, BoundNode initializersBody, Boolean reportNullableDiagnostics, ImportChain& importChain, Boolean& originalBodyNested, Boolean& prependedDefaultValueTypeConstructorInitializer, InitialState& forSemanticModel)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs(1061,0): at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, Int32 methodOrdinal, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs(527,0): at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol containingType)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs(429,0): at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass25_0.<CompileNamedTypeAsync>b__0()
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\Core\Portable\InternalUtilities\UICultureUtilities.cs(139,0): at Roslyn.Utilities.UICultureUtilities.<>c__DisplayClass5_0.<WithCurrentUICulture>b__0()
[xUnit.net 00:00:07.02]            at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
[xUnit.net 00:00:07.02]         --- End of stack trace from previous location ---
[xUnit.net 00:00:07.02]            at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
[xUnit.net 00:00:07.02]            at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[xUnit.net 00:00:07.02]         --- End of stack trace from previous location ---
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs(328,0): at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers()
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs(160,0): at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean emittingPdb, Boolean hasDeclarationErrors, Boolean emitMethodBodies, BindingDiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs(2935,0): at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsForAllMethodBodies(BindingDiagnosticBag diagnostics, Boolean doLowering, CancellationToken cancellationToken)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs(2907,0): at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnosticsWithoutFiltering(CompilationStage stage, Boolean includeEarlierStages, BindingDiagnosticBag builder, CancellationToken cancellationToken)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs(2818,0): at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnostics(CompilationStage stage, Boolean includeEarlierStages, DiagnosticBag diagnostics, CancellationToken cancellationToken)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs(2809,0): at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnostics(CompilationStage stage, Boolean includeEarlierStages, CancellationToken cancellationToken)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs(2803,0): at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnostics(CancellationToken cancellationToken)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\Test\Core\Diagnostics\DiagnosticExtensions.cs(108,0): at Microsoft.CodeAnalysis.DiagnosticExtensions.VerifyDiagnostics[TCompilation](TCompilation c, DiagnosticDescription[] expected)
[xUnit.net 00:00:07.02]         C:\Users\janjones\Code\roslyn\src\Compilers\CSharp\Test\Semantic\Semantics\NullableReferenceTypesTests.cs(87614,0): at Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics.NullableReferenceTypesTests.ForEach_26()
[xUnit.net 00:00:07.02]            at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
[xUnit.net 00:00:07.02]            at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
[xUnit.net 00:00:07.03]   Finished:    Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 17, 2023
@jjonescz jjonescz marked this pull request as ready for review August 17, 2023 14:10
@jjonescz jjonescz requested a review from a team as a code owner August 17, 2023 14:10
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 1)

@jcouv jcouv self-assigned this Aug 17, 2023
@jjonescz jjonescz merged commit 2e76cde into dotnet:main Aug 17, 2023
25 checks passed
@jjonescz jjonescz deleted the 69539-NullableWalker-AwaitForeach branch August 17, 2023 16:49
@ghost ghost added this to the Next milestone Aug 17, 2023
@dibarbet dibarbet modified the milestones: Next, 17.8 P2 Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers New Language Feature - Nullable Reference Types Nullable Reference Types untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assert when typing await foreach
4 participants