Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

The managed assembly loading algorithm documentation didn't explain that LoadFromPath, LoadFromStream, and similar methods use default probing logic (including APP_PATHS) when called on the default AssemblyLoadContext, before attempting to load from the specified path or stream.

Changes

  • Updated loading-managed.md algorithm step 3: Added explicit documentation that when the active AssemblyLoadContext is the default instance, the runtime first checks the default probing logic (TPA list, APP_PATHS) before loading from the specified path or raw assembly object.

  • Updated default-probing.md managed assembly default probing section: Added clarification that assemblies found in TRUSTED_PLATFORM_ASSEMBLIES or APP_PATHS take precedence over specified paths or raw assembly objects when loading in the default AssemblyLoadContext, with concrete examples using LoadFromStream and LoadFromAssemblyPath.

This clarifies unexpected behavior where AssemblyLoadContext.Default.LoadFromStream(stream) may load an assembly from disk instead of the stream if a matching assembly exists in APP_PATHS:

// With APP_PATHS set, this may load from disk instead of stream
// if an assembly with matching name exists in APP_PATHS
var assembly = AssemblyLoadContext.Default.LoadFromStream(memoryStream);

Related: dotnet/runtime#122304

Original prompt

Update the docs at dotnet/core/dependency-loading/loading-managed to indicate that for other types of loads, if the default AssemblyLoadContext is the active one, the managed assembly default probing logic is used before loading from the specified path or raw assembly object.

Related: dotnet/runtime#122304


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Internal previews

📄 File 🔗 Preview link
docs/core/dependency-loading/default-probing.md Default probing
docs/core/dependency-loading/loading-managed.md Managed assembly loading algorithm - .NET Core

…-name loads

Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Copilot AI changed the title [WIP] Update docs for AssemblyLoadContext behavior Document default probing behavior in AssemblyLoadContext for LoadFromPath/LoadFromStream Jan 15, 2026
Copilot AI requested a review from elinor-fung January 15, 2026 19:25
@elinor-fung
Copy link
Member

@copilot also update dotnet/core/dependency-loading/default-probing to indicate that any assemblies in TRUSTED_PLATFORM_ASSEMBLIES or APP_PATHS take precedence when loading in the default AssemblyLoadContext (for example, over a specified path or raw assembly object).

Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot also update dotnet/core/dependency-loading/default-probing to indicate that any assemblies in TRUSTED_PLATFORM_ASSEMBLIES or APP_PATHS take precedence when loading in the default Assembly...

Updated default-probing.md to clarify that assemblies in TRUSTED_PLATFORM_ASSEMBLIES or APP_PATHS take precedence over specified paths or raw assembly objects when loading in the default AssemblyLoadContext. Added concrete examples using LoadFromStream and LoadFromAssemblyPath. (commit 019631d)

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 pull request documents previously undocumented behavior in the .NET assembly loading algorithm where the default AssemblyLoadContext applies default probing logic (checking TPA list and APP_PATHS) before loading from explicitly specified paths or streams.

Changes:

  • Added a step in the managed assembly loading algorithm to document that default probing runs before loading from specified paths when using the default AssemblyLoadContext
  • Added explanatory paragraph with concrete examples showing that assemblies in TRUSTED_PLATFORM_ASSEMBLIES or APP_PATHS take precedence over explicitly specified paths or streams

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
docs/core/dependency-loading/loading-managed.md Added algorithm step documenting default probing precedence for LoadFromPath/LoadFromStream methods on default AssemblyLoadContext
docs/core/dependency-loading/default-probing.md Added explanatory paragraph with examples showing how default probing takes precedence over specified paths and streams

Copy link
Contributor

@adegeo adegeo left a comment

Choose a reason for hiding this comment

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

This looks good. I had one minor suggestion to help the readability of how AssemblyLoadContext.Default will print.

Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
@adegeo adegeo merged commit b5d6ba3 into main Jan 16, 2026
11 checks passed
@adegeo adegeo deleted the copilot/update-docs-dependency-loading branch January 16, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants