Registry Mirror
Skip to content

Conversation

@ds5678

@ds5678 ds5678 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

I'm trying to trim types from my application, and I'm having issues with the NativeAOT compiler not realizing that my parameters are never null.

AssemblyReferenceClassifier = assemblyReferenceClassifier ?? new AssemblyReferenceClassifier();

this.projectWriter = projectWriter ?? (Settings.UseSdkStyleProjectFormat ? ProjectFileWriterSdkStyle.Create() : ProjectFileWriterDefault.Create());

Solution

  • I created an interface IAssemblyReferenceClassifier and replaced most uses of AssemblyReferenceClassifier with it.
  • I moved default initialization from the most specific WholeProjectDecompiler constructor to the second most one.
  • I added ArgumentNullException checks to the most specific WholeProjectDecompiler constructor.

@ds5678
ds5678 force-pushed the iassemblyreferenceclassifier branch from b46abed to e3f45c8 Compare July 30, 2026 06:17
@siegfriedpammer
siegfriedpammer merged commit 546f802 into icsharpcode:master Jul 30, 2026
7 checks passed
@siegfriedpammer

Copy link
Copy Markdown
Member

Thank you for your contribution!

@ds5678
ds5678 deleted the iassemblyreferenceclassifier branch July 30, 2026 17:57
VladimirReshetnikov added a commit to VladimirReshetnikov/ILSpy that referenced this pull request Aug 10, 2026
Upstream replaced the ID-string grammar parser with metadata-level
name-based matching, removing IMemberReference and its implementations;
the fork's additions to those files were documentation only, so the
deletions win. The IAssemblyReferenceClassifier interface (PR icsharpcode#3903) and
the fork's classifier documentation both stand. In
WholeProjectDecompiler, the fork's WriteResourceFile factoring - which
BamlAwareWholeProjectDecompiler overrides - is kept, with upstream's
nullable annotations applied inside it.

Merge fallout: the fork's tests updated to upstream's publicized writer
singletons (Default/Instance replacing Create), the test project-info
provider to the classifier interface, and one cref disambiguated against
the new FindEntity overload.

Assisted-by: Claude:claude-fable-5:Claude Code
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.

2 participants