Skip to content

Conversation

elinor-fung
Copy link
Member

When getting a resource where ResourceResolve handler returns an assembly with a manifest resource that is an assembly ref, we incorrectly resolved the reference on the original assembly instead of the assembly returned by the handler and then also looked for the resource on the original assembly again instead of using the referenced assembly.

Added a test for this case using IL. The manifest resource file (as opposed to assembly ref) case is already covered in libraries tests.

As called out in #111537, this is a regression in .NET 9 from eae1542.

@Copilot Copilot AI review requested due to automatic review settings February 22, 2025 04:34
@elinor-fung elinor-fung added this to the 10.0.0 milestone Feb 22, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (5)
  • src/coreclr/vm/peassembly.cpp: Language not supported
  • src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.il: Language not supported
  • src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.ilproj: Language not supported
  • src/tests/Loader/ResourceResolve/ResourceAssembly.csproj: Language not supported
  • src/tests/Loader/ResourceResolve/ResourceResolve.csproj: Language not supported
Comments suppressed due to low confidence (1)

src/tests/Loader/ResourceResolve/ResourceResolve.cs:33

  • [nitpick] The variable name 'expected' is ambiguous. It should be renamed to 'expectedStream' for clarity.
Stream expected = resourceAssembly.GetManifestResourceStream(resourceName);

Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@elinor-fung elinor-fung merged commit 2a19c9d into dotnet:main Feb 24, 2025
97 of 100 checks passed
@elinor-fung
Copy link
Member Author

/backport to release/9.0-staging

Copy link
Contributor

Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/13508910718

Copy link
Contributor

@elinor-fung backporting to "release/9.0-staging" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix getting resource when ResourceResolve returns assembly with resource that is an assembly ref
Using index info to reconstruct a base tree...
M	src/coreclr/vm/peassembly.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/vm/peassembly.cpp
CONFLICT (content): Merge conflict in src/coreclr/vm/peassembly.cpp
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix getting resource when ResourceResolve returns assembly with resource that is an assembly ref
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

elinor-fung added a commit to elinor-fung/runtime that referenced this pull request Feb 25, 2025
…rce that is an assembly ref (dotnet#112810)

When getting a resource where `ResourceResolve` handler returns an assembly with a manifest resource that is an assembly ref, we incorrectly resolved the reference on the original assembly instead of the assembly returned by the handler and then also looked for the resource on the original assembly again instead of using the referenced assembly.

This change includes a test for this case using IL. The manifest resource file (as opposed to assembly ref) case is already covered in libraries tests.
@elinor-fung elinor-fung deleted the fix111537 branch February 25, 2025 18:15
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants