Skip to content

System.InvalidCastException: Unable to cast object of type 'ICSharpCode.Decompiler.IL.Nop' to type 'ICSharpCode.Decompiler.IL.Block'. #3891

Description

@Lancelotbronner

Steps to reproduce

  1. Decompile the WorldwideRush.dll file from the Worldwide Rush game
  2. Try to save code
  3. Crash while decompiling STM.Data.NetworkSession.HandleFailedToConnect
  4. Note that this object does not appear in the list of methods/fields/etc. of STM.Data.NetworkSession

It seems like the issue is with an unprotected cast so I don't think I need to provide the DLL?

Error message shown

Error decompiling @06001E23 STM.Data.NetworkSession.HandleFailedToConnect
 ---> System.InvalidCastException: Unable to cast object of type 'ICSharpCode.Decompiler.IL.Nop' to type 'ICSharpCode.Decompiler.IL.Block'.
   at System.Runtime.CompilerServices.CastHelpers.<IsInstanceOf_NoCacheLookup>g____PInvoke|4_0(Void* __toTypeHnd_native, Int32 __throwCastException_native, ObjectHandleOnStack __obj_native) in offset 0
   at System.Runtime.CompilerServices.CastHelpers.<IsInstanceOf_NoCacheLookup>g____PInvoke|4_0(Void* __toTypeHnd_native, Int32 __throwCastException_native, ObjectHandleOnStack __obj_native) in offset 0
   at System.Runtime.CompilerServices.CastHelpers.ChkCastAny_NoCacheLookup(Void* toTypeHnd, Object obj) in offset 0
   at System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj) in offset 22
   at ICSharpCode.Decompiler.IL.ReduceNestingTransform.ExtractElseBlock(IfInstruction ifInst) in ReduceNestingTransform.cs:line 608
   at ICSharpCode.Decompiler.IL.ReduceNestingTransform.ReduceNesting(Block block, IfInstruction ifInst, ILInstruction exitInst) in ReduceNestingTransform.cs:line 280
   at ICSharpCode.Decompiler.IL.ReduceNestingTransform.Visit(Block block, Block continueTarget, ILInstruction nextInstruction) in ReduceNestingTransform.cs:line 118
   at ICSharpCode.Decompiler.IL.ReduceNestingTransform.Visit(BlockContainer container, Block continueTarget) in ReduceNestingTransform.cs:line 76
   at ICSharpCode.Decompiler.IL.ReduceNestingTransform.Visit(Block block, Block continueTarget, ILInstruction nextInstruction) in ReduceNestingTransform.cs:line 104
   at ICSharpCode.Decompiler.IL.ReduceNestingTransform.Visit(BlockContainer container, Block continueTarget) in ReduceNestingTransform.cs:line 76
   at ICSharpCode.Decompiler.IL.ReduceNestingTransform.Run(ILFunction function, ILTransformContext context) in ReduceNestingTransform.cs:line 49
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileBody(IMethod method, EntityDeclaration entityDecl, DecompileRun decompileRun, ITypeResolveContext decompilationContext, ExtensionInfo extensionInfo) in CSharpDecompiler.cs:line 2077
-- 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.<DoDecompile>g__DoDecompileMember|76_0(IEntity entity, RecordDecompiler recordDecompiler, PartialTypeInfo partialType, ExtensionInfo extensionInfo, <>c__DisplayClass76_0&) in CSharpDecompiler.cs:line 1789
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(ITypeDefinition typeDef, DecompileRun decompileRun, ITypeResolveContext decompilationContext, Boolean asExtension) in offset 0
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(IEnumerable`1 definitions) in CSharpDecompiler.cs:line 1246
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass58_0.<DecompileAsync>b__0() in offset 35

Details

  • ILSpy version 10.1.1.8388+1377eb6e7351b21112858c8c1df39848f40181ec
  • .NET version 10.0.10-servicing.26326.116+f7d90799ce4ef09a0bb257852a57248d2a8fb8dd

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions