Skip to content

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Jul 21, 2022

Fixes #2903

I tried to actually fix the re-entrancy instead of putting a temporary value in the cache, because this will make it easier to fix the behavior of CheckRequiresReflectionMethodBodyScanner to not consider type parameter annotations.

Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

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

I actually coded the simple fix during the day, but didn't manage to send a PR for it :-). Anyway, I added some more tests - maybe you could merge the tests with this change: https://github.com/vitek-karas/linker/tree/FixSOInCompilerGeneratedCodeMarking

sbomer added 2 commits July 21, 2022 11:10
Adjust comments, clarify lack of cache
@sbomer
Copy link
Member Author

sbomer commented Jul 21, 2022

I almost made the PR yesterday but wanted to think a bit more about it :). Thanks for the extra tests!

Comment on lines +3466 to +3467
// This should only be called behind a check to IsProcessed for the method or corresponding user method,
// to avoid recursion.
Copy link
Member

Choose a reason for hiding this comment

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

Can we assert this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - I considered adding an assert originally but didn't want to do a potentially expensive operation with side effects in debug mode. But it's probably worth it to have the assert. We should get test coverage for release mode in the official build so it's probably fine.

Copy link
Member

Choose a reason for hiding this comment

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

Side-effects? I don't really see anything here which should cause side effects, but I could be wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh sorry - I meant that it could change the order in which we build the compiler-generated code maps.

Copy link
Member

Choose a reason for hiding this comment

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

True - on the other hand if there's a bug in that.. we have a bigger problem :-)

- Add asserts
- Fix method name
@sbomer sbomer merged commit 5809152 into dotnet:main Jul 21, 2022
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
This fixes endless recursion introduced by the change which scans
compiler-generated methods as a group.

This change fixes the re-entrancy instead of putting a temporary value
in the cache, because this will make it easier to fix the behavior of
CheckRequiresReflectionMethodBodyScanner to not consider type
parameter annotations.

Commit migrated from dotnet/linker@5809152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publishing a blazor wasm app throws a Mono Linker exception in .NET 7.0 Preview 6

2 participants