[release/8.0-staging] [mono][eventpipe] Fix firing dynamic method wrappers crash #99712
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.
Backport of #99617 to release/8.0-staging
/cc @mdh1418
Customer Impact
#93687
dotnet/diagnostics#4542
Applications using the mono runtime may crash while closing an EventPipeSession when working with diagnostics tooling. If the application contains code compiled as dynamic method wrappers by the mono compiler that is hit during an EventPipeSession, the mono runtime eventpipe provider will attempt to fire the corresponding method event during rundown, which occurs when closing the EventPipeSession (e.g. Pressing Enter or Ctrl+c to stop
dotnet trace collect
). If the dynamic method wrapper is missing themethod_data
metadata, an assert will crash the application.Regression
Testing
Reproduced the application crash by following reproduction steps from dotnet/diagnostics#4542.
After Injecting a locally built runtime with the following change, the application no longer crashes upon ending the
dotnet trace collect
process.Risk
Low. The assert is circumvented for dynamic method wrappers.