Skip to content

Fix SOS layout resolution for single-file tools - #5961

Open
hoyosjs wants to merge 1 commit into
dotnet:mainfrom
hoyosjs:juhoyosa/fix-single-file-sos-layout
Open

Fix SOS layout resolution for single-file tools#5961
hoyosjs wants to merge 1 commit into
dotnet:mainfrom
hoyosjs:juhoyosa/fix-single-file-sos-layout

Conversation

@hoyosjs

@hoyosjs hoyosjs commented Aug 13, 2026

Copy link
Copy Markdown
Member

Fix SOS package asset resolution for true single-file diagnostics tools by rooting package-relative paths at AppContext.BaseDirectory.

This prevents SOS.InstallHelper from failing when its bundled assembly has no on-disk location, while preserving the existing adjacent RID and lib directory layout.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 928337e2-55f3-4f09-a49a-cc17f8a1a2a1
Copilot AI lite review requested due to automatic review settings August 13, 2026 00:45
@hoyosjs
hoyosjs requested a review from a team as a code owner August 13, 2026 00:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates SOS package asset path resolution to work correctly in true single-file diagnostics tools by anchoring package-relative paths to AppContext.BaseDirectory instead of the consuming assembly’s on-disk location, preventing failures when assemblies have no Assembly.Location.

Changes:

  • Root package-relative paths at AppContext.BaseDirectory to support single-file apps.
  • Remove Assembly.Location-based base directory computation and its failure mode.
  • Update XML docs to describe the new rooting behavior.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +39 to +40
/// The directory containing the application. All package-relative paths are
/// rooted here.
/// <summary>
/// The directory of the package this type is compiled into. All package-relative
/// paths are rooted here.
/// The directory containing the application. All package-relative paths are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what does 'application' refer to? When SOS is loaded inside windbg or lldb is it refering to the path where windbg.exe/lldb resides?

/// rooted here.
/// </summary>
private static string s_packageBaseDirectory = ComputePackageBaseDirectory();
private static readonly string s_packageBaseDirectory = AppContext.BaseDirectory;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does the SOS host set this directory somewhere? Does this resolve to a path when loaded from an unmanaged host?

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