Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Documents that LoadFromAssemblyPath and LoadFromStream methods on the default AssemblyLoadContext will use assemblies from the default probing path when the assembly name matches, rather than loading from the specified path/stream.

Changes

  • Added remarks to LoadFromAssemblyPath(string) explaining default probing precedence
  • Added remarks to LoadFromStream(Stream) and LoadFromStream(Stream, Stream) with same behavior note
  • All remarks link to the managed assembly loading algorithm documentation

Example

// When called on the default context:
var defaultContext = AssemblyLoadContext.Default;

// If "MyAssembly" exists in the default probing path,
// that version loads instead of the one at the specified path
var asm = defaultContext.LoadFromAssemblyPath("/custom/path/MyAssembly.dll");

Related: dotnet/docs#51185, dotnet/runtime#122304

Original prompt

Add remarks to AssemblyLoadContext.LoadFromAssemblyPath and LoadFromStream to indicate that when operating on the default AssemblyLoadContext, if the assembly has a name matching one that is part of its default probing, that is used instead. Link to the docs on managed assembly default probing.

Related: dotnet/docs#51185, dotnet/runtime#122304


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add remarks to AssemblyLoadContext load methods for default probing Add remarks to AssemblyLoadContext load methods documenting default context probing behavior Jan 15, 2026
Copilot AI requested a review from elinor-fung January 15, 2026 19:57
@elinor-fung elinor-fung marked this pull request as ready for review January 15, 2026 22:53
@elinor-fung elinor-fung requested a review from a team as a code owner January 15, 2026 22:53
Copilot AI review requested due to automatic review settings January 15, 2026 22:53
Copy link
Contributor

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.

Pull request overview

This PR adds documentation to clarify the behavior of LoadFromAssemblyPath and LoadFromStream methods when called on the default AssemblyLoadContext. The remarks explain that when the assembly name matches one in the default probing path, the assembly from the default probing path is loaded instead of the one from the specified path or stream.

Changes:

  • Added remarks to LoadFromAssemblyPath(string) documenting default context probing precedence
  • Added remarks to LoadFromStream(Stream) documenting the same behavior
  • Added remarks to LoadFromStream(Stream, Stream) documenting the same behavior
Comments suppressed due to low confidence (1)

xml/System.Runtime.Loader/AssemblyLoadContext.xml:905

  • The second LoadFromStream overload is missing a <related> element that should be added for consistency with the first overload and LoadFromAssemblyPath. Add the following line after the closing </remarks> tag and before the </Docs> tag: <related type="Article" href="/dotnet/core/dependency-loading/loading-managed">Managed assembly loading algorithm</related>
      </Docs>

@gewarren gewarren merged commit e415273 into main Jan 15, 2026
12 checks passed
@gewarren gewarren deleted the copilot/add-remarks-to-assemblyloadcontext branch January 15, 2026 23:10
@Hazimehhassan Hazimehhassan mentioned this pull request Jan 16, 2026
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.

3 participants