Skip to content

[ilspycmd] Broken PDB generated for MoveNext when using --genpdb #2823

Description

@spouliot

Background

The iOS SDK does not use Source Link and also does not embed sources inside PDB (which would be quite useful for the generated code). I thought ILSpy could help :)

Steps to reproduce

  1. Use ilspycmd to create PDB with sources for Microsoft.iOS.dll

Both

ilspycmd -genpdb Microsoft.iOS.dll -usepdb Microsoft.iOS.pdb

and

ilspycmd -genpdb Microsoft.iOS.dll

were tried.

  1. Try to use the assembly / .pdb
  2. Error while building the application

Original files: Microsoft.iOS.zip

Error message shown

ILLink : error IL1005: System.Net.Http.NSUrlSessionHandler.<SendAsync>d__58: Error processing method 'System.Net.Http.NSUrlSessionHandler.<SendAsync>d__58.MoveNext()' in assembly 'Microsoft.iOS.dll' [/Users/.../DebugMyApp/DebugMyApp.Mobile/DebugMyApp.Mobile.csproj]
  Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: System.Net.Http.NSUrlSessionHandler.<SendAsync>d__58: Error processing method 'System.Net.Http.NSUrlSessionHandler.<SendAsync>d__58.MoveNext()' in assembly 'Microsoft.iOS.dll'
   ---> System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
     at Mono.Cecil.Cil.InstructionOffset..ctor(Instruction instruction)
     at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
     at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
     at Mono.Cecil.Cil.CodeReader.ReadDebugInfo()
     at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
     at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
     at Mono.Cecil.MetadataReader.ReadMethodBody(MethodDefinition method)
     at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
     at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
     at Mono.Cecil.MethodDefinition.get_Body()
     at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, Scope& scope)
     at Mono.Linker.Steps.MarkStep.ProcessQueue()
     --- End of inner exception stack trace ---
     at Mono.Linker.Steps.MarkStep.ProcessQueue()
     at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
     at Mono.Linker.Steps.MarkStep.Process()
     at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
     at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
     at Mono.Linker.Pipeline.Process(LinkContext context)
     at Mono.Linker.Driver.Run(ILogger customLogger)
  Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink

Versions

ilspycmd --version                                                                                                                         ilspycmd: 7.2.1.0
ICSharpCode.Decompiler: 7.2.1.6856

More details

I have hit a few PDB issues in the past so I wrote a tool to see what could be wrong in them (or Cecil).

The output I get is:

Microsoft.iOS

CoreFoundation.CFNetwork/d__15 / System.Void CoreFoundation.CFNetwork/d__15::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

System.Net.Http.NSUrlSessionHandler/NSUrlSessionDataTaskStream/d__14 / System.Void System.Net.Http.NSUrlSessionHandler/NSUrlSessionDataTaskStream/d__14::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

System.Net.Http.NSUrlSessionHandler/d__57 / System.Void System.Net.Http.NSUrlSessionHandler/d__57::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

System.Net.Http.NSUrlSessionHandler/d__58 / System.Void System.Net.Http.NSUrlSessionHandler/d__58::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

System.Net.Http.CFContentStream/d__10 / System.Void System.Net.Http.CFContentStream/d__10::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

System.Net.Http.CFNetworkHandler/d__19 / System.Void System.Net.Http.CFNetworkHandler/d__19::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

System.Net.Http.CFNetworkHandler/d__20 / System.Void System.Net.Http.CFNetworkHandler/d__20::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

Compression.CompressionStream/CopyToAsyncStream/d__8 / System.Void Compression.CompressionStream/CopyToAsyncStream/d__8::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

Compression.CompressionStream/CopyToAsyncStream/d__9 / System.Void Compression.CompressionStream/CopyToAsyncStream/d__9::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

Compression.CompressionStream/d__41 / System.Void Compression.CompressionStream/d__41::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

Compression.CompressionStream/d__73 / System.Void Compression.CompressionStream/d__73::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

Compression.CompressionStream/d__74 / System.Void Compression.CompressionStream/d__74::MoveNext()

System.ArgumentNullException: Value cannot be null. (Parameter 'instruction')
   at Mono.Cecil.Cil.CodeReader.ReadAsyncMethodBody(AsyncMethodBodyDebugInformation async_method)
   at Mono.Cecil.Cil.CodeReader.ReadCustomDebugInformations(MethodDefinition method)
   at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
   at Program.<<Main>$>g__Process|0_0(TypeDefinition type) in /Users/poupou/git/dotnet-tools/cecil-pdb-check/Program.cs:line 29

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions