Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

NullReferenceException in RecordDecompiler on an assembly from Roslyn

Aperta
#4,295 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
67/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
C#
Stelle
26.8k
Fork
3.8k
Merge medio
1g 2h
PR unite (30g)
71

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di icsharpcode/ILSpy

Tutte le issue di icsharpcode/ILSpy

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.