Duplicate sequence point definitions when generating a PDB for real assemblies
Summary
Debug.Assert(false, "Duplicate sequence point definition detected: ...") in PortablePdbWriter.ProcessMethod (ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs line 325) fires when generating a PDB for real-world assemblies. It is a known limitation - it is why the Members PDB fixture is [Ignore]d - but it has no issue tracking it and no reproduction on record.
In a Debug build of ilspycmd the assertion aborts the process, so no PDB is produced at all. In Release the assertion is compiled out and the PDB is written with whatever the duplicate produced. EncodeSequencePoints delta-encodes offsets, and a record whose deltas are all zero is the encoding for "the document changed here", so a duplicate offset that reaches the writer aliases into a document record rather than a sequence point.
Reproduction
AutoMapper 16.2.0, lib/net10.0/AutoMapper.dll:
ilspycmd -genpdb AutoMapper.dllFive methods trip it, all local functions of ProjectionBuilder.CreateProjection:
06000861 <>c__DisplayClass11_0.<CreateProjection>g__ShouldExpand|5
06000863 <>c__DisplayClass11_0.<CreateProjection>g__ResolveSource|7
06000860 <>c__DisplayClass11_0.<CreateProjection>g__TryProjectMember|3
060003C0 ProjectionBuilder.<CreateProjection>g__NullSubstitute|11_10
060003C1 ProjectionBuilder.<CreateProjection>g__GetProjectionMapper|11_8Reproduces with or without the reference closure resolved. A minimal case built from local functions in the same shapes (expression-bodied, static, capturing) does not reproduce it, so the trigger is narrower than "local functions".
Note
The test suite has an oracle-free check for exactly this - PdbSequencePoints.CheckWellFormed, which requires per-method offsets to be strictly increasing - but it only runs over the hand-written TestCases/PdbGen fixtures.
Posted by an AI agent (Claude) on Siegfried's behalf.
Source: icsharpcode/ILSpy