Fix another RuntimeAsync NRE with hoisted methods#82624
Fix another RuntimeAsync NRE with hoisted methods#82624333fred wants to merge 6 commits intodotnet:mainfrom
Conversation
As pointed out by @AlekseyTs, `CSharpCompilation.IsRuntimeAsyncEnabledIn` was assuming that only `SourceMethodSymbol`s would be passed in. This isn't true for extension blocks after local rewriting, which indeed caused a crash when a couple of tests were augmented with attribute-level runtime async codegen suppression. To fix, we move the attribute check up to `MethodSymbol` and implement across all of our symbol types. Fixes dotnet#82571.
|
@jcouv @AlekseyTs @dotnet/roslyn-compiler for review |
src/Compilers/CSharp/Portable/Symbols/ReducedExtensionMethodSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/FunctionPointers/FunctionPointerMethodSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEMethodSymbol.cs
Outdated
Show resolved
Hide resolved
src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs
Outdated
Show resolved
Hide resolved
|
Done with review pass (commit 2) #Closed |
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncSpillTests.cs
Outdated
Show resolved
Hide resolved
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (commit 2)
|
@AlekseyTs @jcouv I've addressed feedback. I've also renamed the property for clarity, since it's not "whether runtime async is enabled", but is actually "whether there's an attribute that's explicitly controlling runtime async". |
|
Done with review pass (commit 3) |
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (commit 3). Just waiting to see how EE question turns out
src/Compilers/CSharp/Portable/Symbols/Wrapped/WrappedMethodSymbol.cs
Outdated
Show resolved
Hide resolved
|
Done with review pass (commit 4) |
|
@AlekseyTs @jcouv for another look please. |
src/Compilers/CSharp/Portable/Symbols/NativeIntegerTypeSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/SubstitutedMethodSymbol.cs
Outdated
Show resolved
Hide resolved
|
|
||
| public override bool IsAsync => _underlyingMethod.IsAsync; | ||
|
|
||
| internal sealed override ThreeState RuntimeAsyncMethodGenerationAttributeSetting => _underlyingMethod.RuntimeAsyncMethodGenerationAttributeSetting; |
| get { return _parameters; } | ||
| } | ||
|
|
||
| public override bool IsAsync => _underlyingMethod.IsAsync; |
| public override bool IsAsync => this.UnderlyingMethod.IsAsync; | ||
| public override ImmutableArray<CustomModifier> RefCustomModifiers => this.UnderlyingMethod.RefCustomModifiers; | ||
| public override TypeWithAnnotations ReturnTypeWithAnnotations => this.UnderlyingMethod.ReturnTypeWithAnnotations; | ||
| internal sealed override ThreeState RuntimeAsyncMethodGenerationAttributeSetting => this.UnderlyingMethod.RuntimeAsyncMethodGenerationAttributeSetting; |
|
Done with review pass (commit 5) |
|
@AlekseyTs please take another look. |
AlekseyTs
left a comment
There was a problem hiding this comment.
LGTM (commit 6), assuming CI is passing
As pointed out by @AlekseyTs,
CSharpCompilation.IsRuntimeAsyncEnabledInwas assuming that onlySourceMethodSymbols would be passed in. This isn't true for extension blocks after local rewriting, which indeed caused a crash when a couple of tests were augmented with attribute-level runtime async codegen suppression. To fix, we move the attribute check up toMethodSymboland implement across all of our symbol types. Fixes #82571.Relates to test plan #75960.