Duplicate sequence point definitions when generating a PDB for real assemblies

Đang mở
#4,123 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu tại ICSharpCode.Decompiler/DebugInfo/PortablePdbWriter.cs, ở PortablePdbWriter.ProcessMethod, và tái hiện vấn đề bằng ilspycmd -genpdb AutoMapper.dll. Đọc PdbSequencePoints.CheckWellFormed và các fixture trong TestCases/PdbGen để hiểu invariant hiện có. Công việc được xem là hoàn tất khi các phương thức được tái hiện không còn kích hoạt assertion, quá trình tạo PDB thành công trong các bản build Debug và các offset của sequence-point theo từng phương thức vẫn tăng строго.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug PDBGen
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.dll

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

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

Ngôn ngữ chính
C#
Star
27.1k
Fork
3.8k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
44

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của icsharpcode/ILSpy

Tất cả issue của icsharpcode/ILSpy

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.