Skip to content

Fix Export NullReferenceException for images/resourcexsd.baml - #3806

Merged
christophwille merged 1 commit into
masterfrom
christophwille/failedtodecompile
Jun 23, 2026
Merged

christophwille merged 1 commit into
masterfrom
christophwille/failedtodecompile

Conversation

@christophwille

Copy link
Copy Markdown
Member

Trying to Export ilspy.dll 10.0.0.8345

image
System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=ILSpy
  StackTrace:
   at ICSharpCode.ILSpy.Languages.CSharpLanguage.ResourceHandlerProjectDecompiler.WriteResourceToFile(String fileName, String resourceName, Stream entryStream) in Z:\GitWorkspace\ILSpy\ILSpy\Languages\CSharpLanguage.cs:line 565

Fix via VS Debugger Agent:

image

Object reference not set to an instance of an object."

@siegfriedpammer siegfriedpammer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Correct, minimal fix: ProjectItemInfo.AdditionalProperties defaults to null, so the old loop dereferenced null on the first .Add(); routing through With(...) lazily allocates the dictionary. No regression risk and matches the reported stack trace.

(This review was written by an AI agent on behalf of Siegfried Pammer.)

@siegfriedpammer siegfriedpammer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Correct, minimal fix: ProjectItemInfo is a record struct whose AdditionalProperties defaults to null, so the old loop dereferenced null on the first .Add(). Routing through With(...) lazily allocates the dictionary via ??=. Matches the reported stack trace; no regression risk (consumers already null-guard AdditionalProperties).

(This review was written by an AI agent on behalf of Siegfried Pammer.)

@christophwille
christophwille merged commit 6f1eb81 into master Jun 23, 2026
13 checks passed
@christophwille
christophwille deleted the christophwille/failedtodecompile branch June 23, 2026 05:29
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