Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDB Generation is confused by enhanced using statements #2177

Closed
cateyes99 opened this issue Sep 28, 2020 · 2 comments
Closed

PDB Generation is confused by enhanced using statements #2177

cateyes99 opened this issue Sep 28, 2020 · 2 comments

Comments

@cateyes99
Copy link

Steps to reproduce

  1. Tried both ILSpy & ilspycmd to generate PDB for Newtonsoft.Json.dll 12.0.3, found both throwing System.ArgumentOutOfRangeException and resulted in producing a size 0 Newtonsoft.Json.pdb.

  2. Tried the same for C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.5\System.Linq.dll & C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.5\System.Linq.Expressions.dll as well, got the same issue.

Error message shown

  • When using ILSpy, here is what it shows:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value
   at System.Reflection.Throw.ValueArgumentOutOfRange()
   at ICSharpCode.Decompiler.DebugInfo.PortablePdbWriter.EncodeSequencePoints(MetadataBuilder metadata, Int32 localSignatureRowId, List`1 sequencePoints)
   at ICSharpCode.Decompiler.DebugInfo.PortablePdbWriter.<>c__DisplayClass2_0.<WritePdb>g__ProcessMethod|7(MethodDefinitionHandle method, DocumentHandle document, List`1 sequencePoints, SyntaxTree syntaxTree)
   at ICSharpCode.Decompiler.DebugInfo.PortablePdbWriter.WritePdb(PEFile file, CSharpDecompiler decompiler, DecompilerSettings settings, Stream targetStream, Boolean noLogo)
   at ICSharpCode.ILSpy.GeneratePdbContextMenuEntry.<>c__DisplayClass3_0.<GeneratePdbForAssembly>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

image

  • When using command ilspycmd Newtonsoft.Json.dll -genpdb, I got:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'value')
   at System.Reflection.Throw.ValueArgumentOutOfRange()
   at System.Reflection.Metadata.BlobWriterImpl.WriteCompressedInteger(BlobBuilder writer, UInt32 value)
   at ICSharpCode.Decompiler.DebugInfo.PortablePdbWriter.EncodeSequencePoints(MetadataBuilder metadata, Int32 localSignatureRowId, List`1 sequencePoints)
   at ICSharpCode.Decompiler.DebugInfo.PortablePdbWriter.<>c__DisplayClass2_0.<WritePdb>g__ProcessMethod|7(MethodDefinitionHandle method, DocumentHandle docuandle method, DocumentHandle document, List`1 sequencePoints, SyntaxTree syntaxTree)
   at ICSharpCode.Decompiler.DebugInfo.PortablePdbWriter.WritePdb(PEFile file, CSharpDecompiler decompiler, DecompilerSettings settings, Stream targetStream,gs settings, Stream targetStream, Boolean noLogo)
   at ICSharpCode.Decompiler.Console.ILSpyCmdProgram.GeneratePdbForAssembly(String assemblyFileName, String pdbFileName, CommandLineApplication app) in D:\GimandLineApplication app) in D:\GitWorkspace\ILSpy\ICSharpCode.Decompiler.Console\IlspyCmdProgram.cs:line 216
   at ICSharpCode.Decompiler.Console.ILSpyCmdProgram.OnExecute(CommandLineApplication app) in D:\GitWorkspace\ILSpy\ICSharpCode.Decompiler.Console\IlspyCmdProde.Decompiler.Console\IlspyCmdProgram.cs:line 109
  • At the end, both produces a size 0 Newtonsoft.Json.pdb.
    image

Details

  • Product in use: ILSpy / ICSharpCode.Decompiler nuget package
  • Version in use: 6.2.0.6124
  • Any other relevant information to the issue, or your interest in contributing a fix.
@cateyes99 cateyes99 added the Bug label Sep 28, 2020
@cateyes99
Copy link
Author

Today I tried JetBrains' dotPeek 64-bit 2020.2.3, and it generated PDB successfully for Newtonsoft.Json.dll 12.0.3. As a result, I managed to debug from my .NET Core C# Web API project into Newtonsoft.Json.dll 12.0.3 by using the generated PDB!

@siegfriedpammer
Copy link
Member

Triage: this is caused by the use of enhanced using statements. The omission of the block syntax needs to be special-cased in PDB generation as well.

@siegfriedpammer siegfriedpammer changed the title Generating PDB throws System.ArgumentOutOfRangeException and results in producing a size 0 PDB PDB Generation is confused by enhanced using statements Oct 4, 2020
dgrunwald pushed a commit that referenced this issue Oct 7, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 3, 2021
ElektroKill added a commit to dnSpyEx/ILSpy that referenced this issue Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants