ILSpy bundled with LINQPad cannot decompile .NET 10 assemblies

Options
JeffMercado
edited July 22 in General

This may or may not be a problem you'll be able to address but I noticed the ILSpy version bundled with LINQPad is unable to decompile .NET 10 assemblies.

If you try to browse any .NET 10 class, you'll get this error in the output tab (in ILSpy):

System.ArgumentException: Argument must be between 0 and 2. (Parameter 'fieldCount')
   at System.Version.<TryFormatCore>g__ThrowArgumentException|35_0[TChar](String failureUpperBound)
   at System.Version.TryFormatCore[TChar](Span`1 destination, Int32 fieldCount, Int32& charsWritten)
   at System.Version.ToString(Int32 fieldCount)
   at ICSharpCode.Decompiler.TypeSystem.DecompilerTypeSystem.InitializeAsync(PEFile mainModule, IAssemblyResolver assemblyResolver, TypeSystemOptions typeSystemOptions) in /_/ICSharpCode.Decompiler/TypeSystem/DecompilerTypeSystem.cs:line 309
   at ICSharpCode.Decompiler.TypeSystem.DecompilerTypeSystem..ctor(PEFile mainModule, IAssemblyResolver assemblyResolver, TypeSystemOptions typeSystemOptions) in /_/ICSharpCode.Decompiler/TypeSystem/DecompilerTypeSystem.cs:line 227
   at ICSharpCode.Decompiler.TypeSystem.DecompilerTypeSystem..ctor(PEFile mainModule, IAssemblyResolver assemblyResolver, DecompilerSettings settings) in /_/ICSharpCode.Decompiler/TypeSystem/DecompilerTypeSystem.cs:line 217
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler..ctor(PEFile module, IAssemblyResolver assemblyResolver, DecompilerSettings settings) in /_/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs:line 256
   at ICSharpCode.ILSpy.CSharpLanguage.CreateDecompiler(PEFile module, DecompilationOptions options)
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileType(ITypeDefinition type, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TreeNodes.TypeTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput)
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass53_0.<DecompileAsync>b__0()

Note you'll need to force the version to .NET 10 to see this happen. I made sure to update to the latest version of the preview (.NET 10.0.0-preview.6.25358.103) and it still occurs. Any assemblies that uses previous .NET versions loads fine.

Comments