Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Don't call AssemblyResolve event for CoreLib resources #12999

Merged
merged 2 commits into from
Jul 24, 2017

Conversation

kouvel
Copy link
Member

@kouvel kouvel commented Jul 24, 2017

Part of fix for #12668:

  • CoreLib resource lookup should not raise the AssemblyResolve event because a misbehaving handler could cause an infinite recursion check and fail-fast to be triggered when the resource is not found, as the issue would repeat when reporting that error
  • A handler could misbehave by returning an assembly that does not match the requested identity or by throwing

Part of fix for #12668:
- CoreLib resource lookup should not raise the AssemblyResolve event because a misbehaving handler could cause an infinite recursion check and fail-fast to be triggered when the resource is not found, as the issue would repeat when reporting that error
- A handler could misbehave by returning an assembly that does not match the requested identity or by throwing
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM otherwise. Thanks!

// return an assembly that does not match, and this can cause recursive resource lookups during error
// reporting. The CoreLib satellite assembly is loaded from relative locations based on the culture, see
// AssemblySpec::Bind().
if (pSpec->GetCodeBase() != nullptr || !pSpec->IsMscorlibSatellite())
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of the GetCodeBase check?

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 right, this check is redundant here. It's part of the same check done by AssemblySpec::Bind. The AssemblyResolve event is not raised when a code base is provided anyway, I'll remove the code base check.

@tarekgh
Copy link
Member

tarekgh commented Jul 24, 2017

LGTM.

@kouvel kouvel merged commit 94d374d into dotnet:master Jul 24, 2017
@kouvel kouvel deleted the LoadFromFix branch July 24, 2017 20:17
kouvel added a commit to kouvel/coreclr that referenced this pull request Jul 25, 2017
* Don't call AssemblyResolve event for CoreLib resources

Part of fix for #12668:
- CoreLib resource lookup should not raise the AssemblyResolve event because a misbehaving handler could cause an infinite recursion check and fail-fast to be triggered when the resource is not found, as the issue would repeat when reporting that error
- A handler could misbehave by returning an assembly that does not match the requested identity or by throwing

* Address feedback
kouvel added a commit that referenced this pull request Aug 17, 2017
Don't call AssemblyResolve event for CoreLib resources

Part of fix for #12668:
- CoreLib resource lookup should not raise the AssemblyResolve event because a misbehaving handler could cause an infinite recursion check and fail-fast to be triggered when the resource is not found, as the issue would repeat when reporting that error
- A handler could misbehave by returning an assembly that does not match the requested identity or by throwing
@karelz karelz modified the milestone: 2.1.0 Aug 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants