Skip to content

Provide a WholeProjectDecompiler constructor with no default parameter values - #3903

Open
ds5678 wants to merge 2 commits into
icsharpcode:masterfrom
ds5678:iassemblyreferenceclassifier
Open

Provide a WholeProjectDecompiler constructor with no default parameter values#3903
ds5678 wants to merge 2 commits into
icsharpcode:masterfrom
ds5678:iassemblyreferenceclassifier

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
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