-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document default probing behavior in AssemblyLoadContext for LoadFromPath/LoadFromStream #51185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…-name loads Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
|
@copilot also update dotnet/core/dependency-loading/default-probing to indicate that any assemblies in |
Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Updated |
There was a problem hiding this 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_ASSEMBLIESorAPP_PATHStake 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 |
adegeo
left a comment
There was a problem hiding this 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>
The managed assembly loading algorithm documentation didn't explain that
LoadFromPath,LoadFromStream, and similar methods use default probing logic (includingAPP_PATHS) when called on the defaultAssemblyLoadContext, before attempting to load from the specified path or stream.Changes
Updated
loading-managed.mdalgorithm step 3: Added explicit documentation that when the activeAssemblyLoadContextis 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.mdmanaged assembly default probing section: Added clarification that assemblies found inTRUSTED_PLATFORM_ASSEMBLIESorAPP_PATHStake precedence over specified paths or raw assembly objects when loading in the defaultAssemblyLoadContext, with concrete examples usingLoadFromStreamandLoadFromAssemblyPath.This clarifies unexpected behavior where
AssemblyLoadContext.Default.LoadFromStream(stream)may load an assembly from disk instead of the stream if a matching assembly exists inAPP_PATHS:Related: dotnet/runtime#122304
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Internal previews