Skip to content

NetFxBinder

Namespace: Dotsider.Core.Analysis

Assembly: Dotsider.Core.dll

CLR-accurate .NET Framework assembly binder for both CLR generations. Consumes a NetFxBindingContext and produces a NetFxBindResult matching what the actual .NET Framework binder would do at runtime: framework unification + machine.config + publisher policy + app config (in CLR walk order, with later layers overriding earlier ones), then locate against the GAC (architecture-prioritized, strong-named only), then the framework runtime directory, then configured codeBase href (fail-fast), then the application base + private paths with culture-aware probing.

public static class NetFxBinder

Object → NetFxBinder

Bind(AssemblyRefInfo, NetFxBindingContext)

Section titled “Bind(AssemblyRefInfo, NetFxBindingContext)”

Binds the requested assembly identity through the supplied .NET Framework binding policy and locates the file the CLR would actually load.

Parameters:

Returns: NetFxBindResult

The bind outcome.

public static NetFxBindResult Bind(AssemblyRefInfo requested, NetFxBindingContext ctx)

Clears all per-context caches (RequestedBindCache, LoadedAssemblyCache, probe counter). Test-only diagnostic for resetting state between assertions.

Parameters:

public static void ClearCaches(NetFxBindingContext ctx)

Filesystem probe count for the supplied context. Test-only diagnostic that proves repeated NetFxBindingContext) calls hit the cache without re-walking the filesystem.

Parameters:

Returns: Int32

The number of filesystem probes performed for ctx.

public static int GetProbeCount(NetFxBindingContext ctx)

The probe locations and GAC token format switch on NetFxRuntimeVersion:

Clr4 (.NET Framework 4.0 – 4.8.x) — GAC at %WINDIR%\Microsoft.NET\assembly\GAC_* with v4.0_<version>__<pkt> tokens; runtime directory v4.0.30319. The bare %WINDIR%\assembly\GAC is consulted as a COM-PIA fallback after the .NET 4 GAC misses.Clr2 (.NET Framework 2.0 / 3.0 / 3.5) — GAC at %WINDIR%\assembly\{GAC_MSIL, GAC_<arch>, GAC} with no-prefix <version>__<pkt> tokens; runtime directory v2.0.50727.

.NET Core / .NET 5+ roots never construct a binding context, so this type is never invoked for them and their probe chain is unchanged.