NullReferenceException in RecordDecompiler on an assembly from Roslyn

Đang mở
#4,295 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
67/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
backend

Hướng nghiên cứu

Start with RecordDecompiler.cs, especially DetectPrimaryConstructor() at line 203, where the reported NullReferenceException occurs. Reproduce by opening Microsoft.CodeAnalysis.CSharp.Workspaces version 5.0.0 in ILSpy and decompiling CSharpSimplifierOptions; confirm the fix by successfully decompiling that class without the exception.

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

Mô tả

Bug
Steps to reproduce
  1. Start ILSpy
  2. Choose "Open from NuGet feed", select Microsoft.CodeAnalysis.CSharp.Workspaces package of version 5.0.0.
  3. Navigate to lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll
  4. In the Microsoft.CodeAnalysis.CSharp.Simplification namespace open class CSharpSimplifierOptions
Error message shown
// Microsoft.CodeAnalysis.CSharp.Workspaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// Microsoft.CodeAnalysis.CSharp.Simplification.CSharpSimplifierOptions

/* Decompilation failed: Error decompiling @02000091 Microsoft.CodeAnalysis.CSharp.Simplification.CSharpSimplifierOptions

Error decompiling @02000091 Microsoft.CodeAnalysis.CSharp.Simplification.CSharpSimplifierOptions
in assembly "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll"
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at ICSharpCode.Decompiler.CSharp.RecordDecompiler.DetectPrimaryConstructor() in RecordDecompiler.cs:line 203
   at ICSharpCode.Decompiler.CSharp.RecordDecompiler..ctor(IDecompilerTypeSystem dts, ITypeDefinition recordTypeDef, DecompilerSettings settings, CancellationToken cancellationToken) in RecordDecompiler.cs:line 65
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(ITypeDefinition typeDef, DecompileRun decompileRun, ITypeResolveContext decompilationContext, Boolean asExtension) in CSharpDecompiler.cs:line 1864
-- continuing with outer exception (ICSharpCode.Decompiler.DecompilerException) --
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(ITypeDefinition typeDef, DecompileRun decompileRun, ITypeResolveContext decompilationContext, Boolean asExtension) in CSharpDecompiler.cs:line 2001
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(IEnumerable`1 definitions) in CSharpDecompiler.cs:line 1468
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(EntityHandle[] definitions) in CSharpDecompiler.cs:line 1440
   at ICSharpCode.ILSpy.Languages.CSharpLanguage.DecompileType(ITypeDefinition type, ITextOutput output, DecompilationOptions options) in offset 29
   at ICSharpCode.ILSpy.TreeNodes.TypeTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options) in offset 0
   at ICSharpCode.ILSpy.TextView.DecompilerTabPageModel.<>c__DisplayClass91_0.<DecompileAsync>b__1() in offset 161
*/
Details
  • Product in use: originally ICSharpCode.Decompiler package, reproduced on ILSpy too
  • Version in use: ILSpy: 11.2.0.10050+c86190ef4e24f3137c13a9275316042842d2fada, ICSharpCode.Decompiler package: 10.0.0.8323-preview3 and 11.2.0.10050
Ngôn ngữ chính
C#
Star
26.8k
Fork
3.8k
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
71

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.