You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New PdbDocument has null CustomDebugInfos, so writing a Portable PDB throws NullReferenceException #584
A PdbDocument created with new PdbDocument() or with the six-argument constructor has CustomDebugInfos == null. Only PdbDocument(SymbolDocument) creates the list. If a module's PdbState contains such a document, writing the module with a Portable PDB throws NullReferenceException. Calling doc.CustomDebugInfos.Add(...) on such a document throws too.
True
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at dnlib.DotNet.Writer.Metadata.AddCustomDebugInformationList(Table table, UInt32 rid, IList`1 cdis) in src/DotNet/Writer/Metadata.cs:line 3367
at dnlib.DotNet.Writer.Metadata.AddPdbDocument(PdbDocument doc) in src/DotNet/Writer/Metadata.cs:line 3498
at dnlib.DotNet.Writer.Metadata.AddPdbDocuments() in src/DotNet/Writer/Metadata.cs:line 3481
Expected: a new document has an empty, non-null CustomDebugInfos list, and the module and its PDB are written.
I reproduced this on master (9ab9b58), using dnlib's net6.0 build with .NET SDK 10.0.401 on Linux x64. The files involved are unchanged since v4.5.0.
Cause: commit 628db9b ("Support embedded sources, source link, source server") removed the customDebugInfos field initializer and creates the list in Initialize(SymbolDocument) instead. The other two public constructors never call Initialize, so their documents keep a null list.
I noticed this while reviewing #580, where I offered to report it separately. I'll open a PR with a fix.
Activity