Skip to content

Issues decompiling fields and methods/ (rva=0xYYYY) could not be foundin any section! #3492

Open
@greenozon

Description

@greenozon

Input code

just browse the binary eg ns0/GClass3 etc

Erroneous output

 ---> System.BadImageFormatException: Field data (rva=0xa730) could not be foundin any section!
   at ICSharpCode.Decompiler.SRMExtensions.GetInitialValue(FieldDefinition field, MetadataFile pefile, ICompilation typeSystem) in SRMExtensions.cs:line 641
   at ICSharpCode.Decompiler.IL.Transforms.TransformArrayInitializers.HandleRuntimeHelpersInitializeArray(Block body, Int32 pos, ILVariable array, IType arrayType, Int32[] arrayLength, ILInstruction[]& values, Int32& foundPos) in TransformArrayInitializers.cs:line 851
   at ICSharpCode.Decompiler.IL.Transforms.TransformArrayInitializers.DoTransform(ILFunction function, Block body, Int32 pos) in TransformArrayInitializers.cs:line 67
   at ICSharpCode.Decompiler.IL.Transforms.TransformArrayInitializers.ICSharpCode.Decompiler.IL.Transforms.IStatementTransform.Run(Block block, Int32 pos, StatementTransformContext context) in TransformArrayInitializers.cs:line 45
   at ICSharpCode.Decompiler.IL.Transforms.StatementTransform.Run(Block block, BlockTransformContext context) in StatementTransform.cs:line 140
   at ICSharpCode.Decompiler.IL.Block.RunTransforms(IEnumerable`1 transforms, BlockTransformContext context) in Block.cs:line 333
   at ICSharpCode.Decompiler.IL.Transforms.BlockILTransform.VisitBlock(ControlFlowNode entryNode, BlockTransformContext context) in BlockTransform.cs:line 136
   at ICSharpCode.Decompiler.IL.Transforms.BlockILTransform.Run(ILFunction function, ILTransformContext context) in BlockTransform.cs:line 100
   at ICSharpCode.Decompiler.IL.ILFunction.RunTransforms(IEnumerable`1 transforms, ILTransformContext context) in ILFunction.cs:line 415
   at ICSharpCode.Decompiler.CSharp.RecordDecompiler.DecompileBody(IMethod method) in RecordDecompiler.cs:line 1161
   at ICSharpCode.Decompiler.CSharp.RecordDecompiler.<DetectPrimaryConstructor>g__IsPrimaryConstructor|16_0(IMethod method, IMethod unspecializedMethod) in RecordDecompiler.cs:line 194
   at ICSharpCode.Decompiler.CSharp.RecordDecompiler.DetectPrimaryConstructor() in RecordDecompiler.cs:line 183
   at ICSharpCode.Decompiler.CSharp.RecordDecompiler..ctor(IDecompilerTypeSystem dts, ITypeDefinition recordTypeDef, DecompilerSettings settings, CancellationToken cancellationToken) in RecordDecompiler.cs:line 61
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(ITypeDefinition typeDef, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in CSharpDecompiler.cs:line 1320
-- continuing with outer exception (ICSharpCode.Decompiler.DecompilerException) --
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(ITypeDefinition typeDef, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in CSharpDecompiler.cs:line 1478
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(IEnumerable`1 definitions) in CSharpDecompiler.cs:line 1041
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(EntityHandle[] definitions) in CSharpDecompiler.cs:line 1013
   at ICSharpCode.ILSpy.CSharpLanguage.DecompileType(ITypeDefinition type, ITextOutput output, DecompilationOptions options) in offset 93
   at ICSharpCode.ILSpy.TreeNodes.TypeTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options) in offset 8
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput) in offset 122
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass58_0.<DecompileAsync>b__0() in offset 20

at the same time no issues when using dnSpy(ex)

eg

Image

Details

  • ILSpy version 9.1.0.8004+82e461be8c74782943ad32210eb9559176cc5d41
  • .NET version 8.0.15+50c4cb9fc31c47f03eac865d7bc518af173b74b7

https://www.sendspace.com/file/d21r6f

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