Skip to content

System.Xml.XPath.XDocumentExtensions+XDocumentNavigable.CreateNavigator fails to decompile. #3938

Description

@teo-tsirpanis

Input code

ilspy-dll.zip

You can also use stock System.Xml.XPath.XDocument.dll from the .NET shared framework (tested with .NET 10 and 11).

The exception reproduces when viewing any individual member of the XDocumentNavigable class in the decompiler. It does not reproduce when decompiling the whole class.

Erroneous output

Error decompiling @06000003 System.Xml.XPath.XDocumentExtensions.XDocumentNavigable.CreateNavigator
in assembly "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.10\System.Xml.XPath.XDocument.dll"
 ---> System.InvalidOperationException: Nullable object must have a value.
   at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_NoValue() in offset 10
   at System.Nullable`1.get_Value() in offset 8
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileBody(IMethod method, EntityDeclaration entityDecl, DecompileRun decompileRun, ITypeResolveContext decompilationContext, ExtensionInfo extensionInfo) in CSharpDecompiler.cs:line 2036
-- continuing with outer exception (ICSharpCode.Decompiler.DecompilerException) --
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileBody(IMethod method, EntityDeclaration entityDecl, DecompileRun decompileRun, ITypeResolveContext decompilationContext, ExtensionInfo extensionInfo) in CSharpDecompiler.cs:line 2113
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(IMethod method, DecompileRun decompileRun, ITypeResolveContext decompilationContext, ExtensionInfo extensionInfo) in CSharpDecompiler.cs:line 1953
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(IEnumerable`1 definitions) in CSharpDecompiler.cs:line 1259
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileMethod(IMethod method, ITextOutput output, DecompilationOptions options) in offset 0
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass58_0.<DecompileAsync>b__0() in offset 35

Details

  • Product in use: ILSpy
  • Version in use: 10.1.1.8388+1377eb6e7351b21112858c8c1df39848f40181ec
  • It throws only when setting language version to C# 14 and above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDecompilerThe decompiler engine itself

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions