Get the normal event accessors generated #89441
Merged
+48
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because System.Threading.dll was not referenced, this led to Roslyn generating the Delegate.Combine based accessor which does not have any locals. https://github.com/dotnet/roslyn/blob/520e2f10078ab0e5f85c78fdd95d786d78b9676a/src/Compilers/CSharp/Portable/Compiler/MethodBodySynthesizer.cs#L323-L520
In our UnityLinker test framework we have 2 cases currently. Mono, which will reference mscorlib.dll, and Roslyn will find
System.Threading.Interlocked.CompareExchange
and use the normal approach.And currently I have our coreclr tests referencing System.Threading.dll for no great reason. This is how I stumbled on this.
While this change isn't strictly necessary, I think it's better to have coverage on the
System.Threading.Interlocked.CompareExchange
approach because that's what would normally be generated. It's also the more complex case for the linker to handle since it has to clear the locals.