Repository navigation
Native AOT fidelity follow-up: resolver lookup, culture independence, gate coverage - #4268
Merged
Merged
Conversation
… hosts A framework-dependent app resolves .NET Framework and netstandard facades from the shared framework it runs on. A Native AOT or single-file build of the same app has to locate an installed shared framework instead, and the lookup took the newest one of the dotnet on PATH, which differs from the framework-dependent host in three measured cases: with dotnet installed but not on PATH (the host finds it through DOTNET_ROOT and the default install locations, the resolver found nothing and every corlib type became unknown); for a self-contained host, whose own directory holds the facades but is not named like a shared framework, so it was passed over for whatever dotnet was on PATH; and when several majors are installed, where the newest was taken rather than the host's own. The lookup now accepts any runtime directory that holds the facades, walks DOTNET_ROOT and the default install locations before PATH, and prefers the shared framework of the host's own major version. Assisted-by: Claude:claude-fable-5-1:Claude Code
Native AOT apps usually run in invariant globalization mode, framework- dependent apps on ICU with the user's culture, and the decompiler gave them different text for the same input: local functions were ordered with the culture comparer (ICU puts "alpha" before "Beta", invariant mode the other way round), and variable names derived from type names went through culture case mapping, which under tr-TR turns "Instruction" into a dotless "ınstruction" (5680 changed lines when decompiling the decompiler itself). The remaining culture-sensitive comparisons and case mappings are switched to ordinal and invariant as well, and the globalization analyzers now keep the decompiler's sources that way. Assisted-by: Claude:claude-fable-5-1:Claude Code
The gate rooted the whole decompiler, so the native binary never ran with the decompiler trimmed as it is in a consumer's app, and both sides of the comparison ran in invariant globalization mode, so output that depends on the culture could not show up as a difference. A second native publish leaves the decompiler unrooted, and the managed comparison build now runs on ICU while the native binaries stay in invariant mode. Assisted-by: Claude:claude-fable-5-1:Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #4259 (and #4241) from a review of the Native AOT fidelity of the
ICSharpCode.Decompilerpackage: can a Native AOT consumer and a framework-dependent consumer of the netstandard2.0 assembly produce different output for the same input? Three commits, one per finding class; the assembly stays netstandard2.0-only.How the gaps were found
ICSharpCode.Decompiler.AotTest), an unrooted Native AOT consumer and an ILLink-trimmed consumer (plain dll reference to the Release assembly,EventSourceSupport=true), each compared with a framework-dependent build on the same inputs: Mono.Cecil (net45), the decompiler itself (netstandard2.0), ILSpyX (net10), System.Windows.Forms resources.ilspycmdpublished with-p:IlspyCmdRidPackages=true -r win-x64against the framework-dependent build: 49 switch combinations (whole project, IL, PDB generation and dumps, metadata tables, resources, BAML, nupkg entries, settings, language versions, error paths) over Mono.Cecil, FSharp.Core, NRefactory, Avalonia.Base, ILSpyX, PresentationFramework.Aero and System.Windows.Forms. All identical except the expected+ 0x..frame format in crash traces.dotnetonPATH, withDOTNET_ROOTonly, with a symlinkeddotnet, with two installed majors.Findings and fixes
dotnetonPATH. Measured divergences from a framework-dependent host: withdotnetinstalled but not onPATH(DOTNET_ROOTonly) the native binary printedcorlib -> NOT FOUNDand its output changed; a self-contained host ignored the facades in its own directory as soon as anydotnetwas onPATH; with 10.0 and 11.0 installed the native binary used the 11.0 facades while the net10 framework-dependent host used 10.0. The lookup now accepts a runtime directory that holds the facades, walksDOTNET_ROOT, the default install locations and thenPATH(the host's order, withPATHas the fallback the host does not have), and prefers the host's own major version. Four new resolver tests._gamma, alpha, Beta, Zed; invariant:Beta, Zed, _gamma, alpha), and variable names derived from type names used culture case mapping, so under tr-TRInstruction instructionbecameInstruction ınstruction(5680 changed lines when decompiling the decompiler itself, 158 for Mono.Cecil, in the native and the managed build alike). All measured sites plus the remaining culture-sensitive comparisons and case mappings are ordinal/invariant now,CA1309/CA1310/CA1311are enabled forICSharpCode.Decompiler/**so the sources stay that way, and aCultureIndependenceTestsfixture (tr-TR) and aLocalFunctionspretty case (ordinal order) cover the two measured cases. After the change en-US (ICU), tr-TR and invariant mode give byte-identical output, natively and managed, for all inputs above.RootDecompiler=falseand builds the managed comparison withInvariantGlobalization=false; all three outputs must match.Verification
ICSharpCode.Decompiler.Tests(Release): full suite green after the final change 4682 passed, 0 failed, 24 skipped (the usualILSpy-tests-dependent ignores).DOTNET_ROOT-only and self-contained scenarios resolve.Review of #4259 itself
Every change there holds up: the polyfilled
UnconditionalSuppressMessage, theGetStackTracefallback (frames are kept, verified in an unrooted consumer), the four EventSource suppressions (all ten events fire with identical payloads under ILC and ILLink), the markers, and theNotSupportedExceptionremoval.IsNilis a correct cleanup of an always-false comparison with no behaviour change. Nothing from #3946 was carried over that should not have been.Assisted-by: Claude:claude-fable-5-1:Claude Code