ApphostDetector
Namespace: Dotsider.Core.Analysis
Assembly: Dotsider.Core.dll
Detects .NET apphost executables and locates their companion managed assemblies.
public static class ApphostDetectorInheritance
Section titled “Inheritance”Object → ApphostDetector
Methods
Section titled “Methods”FindBundledEntryAssembly(string)
Section titled “FindBundledEntryAssembly(string)”If the file at exePath is a single-file bundle, extracts the entry assembly (the app’s own managed code) and returns its bytes and name. Uses dotted-name-safe basename matching to locate the entry assembly within the bundle manifest.
Parameters:
exePath(String): Path to the executable file.
Returns: Nullable<Byte[], String>>
The entry assembly bytes and file name, or null if the file is not a
single-file bundle or the entry assembly could not be identified.
public static (byte[] Bytes, string Name)? FindBundledEntryAssembly(string exePath)FindCompanionDll(string)
Section titled “FindCompanionDll(string)”If the binary at exePath is a .NET apphost (embeds both the
companion DLL name and a hostfxr reference), returns the path to the
companion .dll provided it has readable .NET metadata. Works with Windows
.exe files and extensionless Linux/macOS executables.
Parameters:
exePath(String): Path to the executable file.
Returns: String
The full path to the companion managed .dll, or null if the file
is not an apphost, no companion exists, or the companion has no readable .NET
metadata.
public static string? FindCompanionDll(string exePath)Remarks
Section titled “Remarks”dotnet build produces both a managed .dll (the actual assembly with IL and
metadata) and a native apphost launcher that bootstraps the runtime. On Windows the
apphost is a .exe (PE format); on Linux and macOS it is an extensionless
executable (ELF or Mach-O). The apphost has no CLR metadata, so most analysis tabs
are empty. This detector verifies the file is an apphost by requiring two signals:
the companion DLL name embedded in the binary AND a reference to hostfxr
(the .NET host framework resolver). These signals are platform-invariant — the
.NET SDK embeds them identically regardless of binary format.