Only subscribe to AppDomain.AssemblyResolve once#53166
Open
jasonmalinowski wants to merge 1 commit intodotnet:mainfrom
Open
Only subscribe to AppDomain.AssemblyResolve once#53166jasonmalinowski wants to merge 1 commit intodotnet:mainfrom
jasonmalinowski wants to merge 1 commit intodotnet:mainfrom
Conversation
jaredpar
reviewed
May 5, 2021
| protected override Assembly LoadFromPathImpl(string fullPath) | ||
| { | ||
| if (Interlocked.CompareExchange(ref _hookedAssemblyResolve, 0, 1) == 0) | ||
| if (Interlocked.CompareExchange(ref _hookedAssemblyResolve, value: 1, comparand: 0) == 0) |
Member
There was a problem hiding this comment.
Do we have any tests in this area?
Member
Author
There was a problem hiding this comment.
I'll see what I can find. Even if we did, unless the test explicitly asserted the value of the field we probably wouldn't have noticed: since AssemblyResolve stops calling further handlers after one gives a successful resolution, the extra ones just aren't called. So this is really only a memory leak given we might subscribe n times instead of 1 time, but the n is somewhat bounded by the number of analyzers loaded in the process.
jasonmalinowski
added a commit
to jasonmalinowski/omnisharp-roslyn
that referenced
this pull request
May 5, 2021
This is a port of dotnet/roslyn#53166. There's a bigger question here about how to reuse this code better, but this caused a bunch of confusion while debugging an issue.
Member
|
Changing target branch to 16.11 servicing branch |
Contributor
|
@jasonmalinowski can we take this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.