Skip to content

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

Merged
siegfriedpammer merged 2 commits into
icsharpcode:masterfrom
ds5678:iassemblyreferenceclassifier
Jul 30, 2026
Merged

Provide a WholeProjectDecompiler constructor with no default parameter values#3903
siegfriedpammer merged 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
@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
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