-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Description
Steps to reproduce
- Download 1966720 Lethal Company
- Open
Assembly-CSharp.dllUnity.RenderPipelines.HighDefinition.Runtime.dllin ILSpy Avalonia - Search for
ProbeCameraCache.GetOrCreate
Error message shown
Error decompiling @0600134B UnityEngine.Rendering.HighDefinition.ProbeCameraCache.GetOrCreate
in assembly "/home/yoshi/Documents/AssetRipper_linux_x64/Lethal Company/Lethal Company_Data/Managed/Unity.RenderPipelines.HighDefinition.Runtime.dll"
---> System.InvalidCastException: Unable to cast object of type 'ICSharpCode.Decompiler.CSharp.Syntax.TupleExpression' to type 'ICSharpCode.Decompiler.CSharp.Syntax.ObjectCreateExpression'.
at System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj) in offset 19
at System.Runtime.CompilerServices.CastHelpers.ChkCastClassSpecial(Void* toTypeHnd, Object obj) in offset 75
at System.Runtime.CompilerServices.CastHelpers.ChkCastClass(Void* toTypeHnd, Object obj) in offset 12
at ICSharpCode.Decompiler.CSharp.ExpressionBuilder.TranslateObjectAndCollectionInitializer(Block block) in ExpressionBuilder.cs:line 3178
at ICSharpCode.Decompiler.CSharp.ExpressionBuilder.VisitBlock(Block block, TranslationContext context) in ExpressionBuilder.cs:line 3108
at ICSharpCode.Decompiler.IL.Block.AcceptVisitor[C,T](ILVisitor`2 visitor, C context) in Instructions.cs:line 876
at ICSharpCode.Decompiler.CSharp.ExpressionBuilder.Translate(ILInstruction inst, IType typeHint) in ExpressionBuilder.cs:line 161
at ICSharpCode.Decompiler.CSharp.ExpressionBuilder.VisitStLoc(StLoc inst, TranslationContext context) in ExpressionBuilder.cs:line 728
at ICSharpCode.Decompiler.IL.StLoc.AcceptVisitor[C,T](ILVisitor`2 visitor, C context) in Instructions.cs:line 2564
at ICSharpCode.Decompiler.CSharp.ExpressionBuilder.Translate(ILInstruction inst, IType typeHint) in ExpressionBuilder.cs:line 161
at ICSharpCode.Decompiler.CSharp.StatementBuilder.VisitStLoc(StLoc inst) in StatementBuilder.cs:line 114
at ICSharpCode.Decompiler.IL.StLoc.AcceptVisitor[T](ILVisitor`1 visitor) in Instructions.cs:line 2560
at ICSharpCode.Decompiler.CSharp.StatementBuilder.Convert(ILInstruction inst) in StatementBuilder.cs:line 78
at ICSharpCode.Decompiler.CSharp.StatementBuilder.VisitBlock(Block block) in StatementBuilder.cs:line 1187
at ICSharpCode.Decompiler.IL.Block.AcceptVisitor[T](ILVisitor`1 visitor) in Instructions.cs:line 872
at ICSharpCode.Decompiler.CSharp.StatementBuilder.Convert(ILInstruction inst) in StatementBuilder.cs:line 78
at ICSharpCode.Decompiler.CSharp.StatementBuilder.VisitIfInstruction(IfInstruction inst) in StatementBuilder.cs:line 136
at ICSharpCode.Decompiler.IL.IfInstruction.AcceptVisitor[T](ILVisitor`1 visitor) in Instructions.cs:line 1424
at ICSharpCode.Decompiler.CSharp.StatementBuilder.Convert(ILInstruction inst) in StatementBuilder.cs:line 78
at ICSharpCode.Decompiler.CSharp.StatementBuilder.VisitBlock(Block block) in StatementBuilder.cs:line 1187
at ICSharpCode.Decompiler.IL.Block.AcceptVisitor[T](ILVisitor`1 visitor) in Instructions.cs:line 872
at ICSharpCode.Decompiler.CSharp.StatementBuilder.Convert(ILInstruction inst) in StatementBuilder.cs:line 78
at ICSharpCode.Decompiler.CSharp.StatementBuilder.VisitIfInstruction(IfInstruction inst) in StatementBuilder.cs:line 136
at ICSharpCode.Decompiler.IL.IfInstruction.AcceptVisitor[T](ILVisitor`1 visitor) in Instructions.cs:line 1424
at ICSharpCode.Decompiler.CSharp.StatementBuilder.Convert(ILInstruction inst) in StatementBuilder.cs:line 78
at ICSharpCode.Decompiler.CSharp.StatementBuilder.ConvertBlockContainer(BlockStatement blockStatement, BlockContainer container, IEnumerable`1 blocks, Boolean isLoop) in StatementBuilder.cs:line 1390
at ICSharpCode.Decompiler.CSharp.StatementBuilder.ConvertBlockContainer(BlockContainer container, Boolean isLoop) in StatementBuilder.cs:line 1328
at ICSharpCode.Decompiler.CSharp.StatementBuilder.VisitBlockContainer(BlockContainer container) in StatementBuilder.cs:line 1214
at ICSharpCode.Decompiler.IL.BlockContainer.AcceptVisitor[T](ILVisitor`1 visitor) in Instructions.cs:line 847
at ICSharpCode.Decompiler.CSharp.StatementBuilder.Convert(ILInstruction inst) in StatementBuilder.cs:line 78
at ICSharpCode.Decompiler.CSharp.StatementBuilder.ConvertAsBlock(ILInstruction inst) in StatementBuilder.cs:line 83
at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileBody(IMethod method, EntityDeclaration entityDecl, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in CSharpDecompiler.cs:line 1580
-- continuing with outer exception (ICSharpCode.Decompiler.DecompilerException) --
at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DecompileBody(IMethod method, EntityDeclaration entityDecl, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in CSharpDecompiler.cs:line 1604
at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.DoDecompile(IMethod method, DecompileRun decompileRun, ITypeResolveContext decompilationContext) in CSharpDecompiler.cs:line 1478
at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(IEnumerable`1 definitions) in CSharpDecompiler.cs:line 995
at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.Decompile(EntityHandle[] definitions) in CSharpDecompiler.cs:line 952
at ICSharpCode.ILSpy.CSharpILMixedLanguage.MixedMethodBodyDisassembler.Disassemble(PEFile module, MethodDefinitionHandle handle) in CSharpILMixedLanguage.cs:line 92
at ICSharpCode.Decompiler.Disassembler.ReflectionDisassembler.DisassembleMethodBlock(PEFile module, MethodDefinitionHandle handle, GenericContext genericContext) in ReflectionDisassembler.cs:line 373
at ICSharpCode.Decompiler.Disassembler.ReflectionDisassembler.DisassembleMethod(PEFile module, MethodDefinitionHandle handle) in ReflectionDisassembler.cs:line 151
at ICSharpCode.ILSpy.ILLanguage.DecompileMethod(IMethod method, ITextOutput output, DecompilationOptions options) in ILLanguage.cs:line 73
at ICSharpCode.ILSpy.TreeNodes.MethodTreeNode.Decompile(Language language, ITextOutput output, DecompilationOptions options) in MethodTreeNode.cs:line 88
at ICSharpCode.ILSpy.TextView.DecompilerTextView.DecompileNodes(DecompilationContext context, ITextOutput textOutput) in DecompilerTextView.xaml.cs:line 559
at ICSharpCode.ILSpy.TextView.DecompilerTextView.<>c__DisplayClass40_0.<DecompileAsync>b__0() in DecompilerTextView.xaml.cs:line 539
Details
- Product in use: e.g. ILSpy Avalonia, also in AssetRipper
- Version in use: e.g. 7.2.0.0.rc from Nixpkgs
- from [Bug]:
InvalidCastExceptionduring ILSpy decompilation AssetRipper/AssetRipper#1958
IL for `GetOrCreate` method
.method public hidebysig
instance class [UnityEngine.CoreModule]UnityEngine.Camera GetOrCreate (
!K key,
int32 frameCount
) cil managed
{
// Method begins at RVA 0x91e54
// Header size: 12
// Code size: 195 (0xc3)
.maxstack 3
.locals init (
[0] valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>
)
IL_0000: ldarg.0
IL_0001: ldfld class [netstandard]System.Collections.Generic.Dictionary`2<!0, valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>> class UnityEngine.Rendering.HighDefinition.ProbeCameraCache`1<!K>::m_Cache
IL_0006: brtrue.s IL_0013
IL_0008: ldstr "ProbeCameraCache"
IL_000d: newobj instance void [netstandard]System.ObjectDisposedException::.ctor(string)
IL_0012: throw
IL_0013: ldarg.0
IL_0014: ldfld class [netstandard]System.Collections.Generic.Dictionary`2<!0, valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>> class UnityEngine.Rendering.HighDefinition.ProbeCameraCache`1<!K>::m_Cache
IL_0019: ldarg.1
IL_001a: ldloca.s 0
IL_001c: callvirt instance bool class [netstandard]System.Collections.Generic.Dictionary`2<!K, valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>>::TryGetValue(!0, !1&)
IL_0021: brfalse.s IL_003f
IL_0023: ldloc.0
IL_0024: ldfld !0 valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>::Item1
IL_0029: ldnull
IL_002a: call bool [UnityEngine.CoreModule]UnityEngine.Object::op_Equality(class [UnityEngine.CoreModule]UnityEngine.Object, class [UnityEngine.CoreModule]UnityEngine.Object)
IL_002f: brtrue.s IL_003f
IL_0031: ldloc.0
IL_0032: ldfld !0 valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>::Item1
IL_0037: ldnull
IL_0038: callvirt instance bool [netstandard]System.Object::Equals(object)
IL_003d: brfalse.s IL_00a7
IL_003f: ldarg.0
IL_0040: ldfld class [netstandard]System.Collections.Generic.Stack`1<class [UnityEngine.CoreModule]UnityEngine.Camera> class UnityEngine.Rendering.HighDefinition.ProbeCameraCache`1<!K>::m_CameraPool
IL_0045: callvirt instance int32 class [netstandard]System.Collections.Generic.Stack`1<class [UnityEngine.CoreModule]UnityEngine.Camera>::get_Count()
IL_004a: brtrue.s IL_0086
IL_004c: ldstr "Unused Probe Camera"
IL_0051: newobj instance void [UnityEngine.CoreModule]UnityEngine.GameObject::.ctor(string)
IL_0056: dup
IL_0057: ldc.i4.s 61
IL_0059: callvirt instance void [UnityEngine.CoreModule]UnityEngine.Object::set_hideFlags(valuetype [UnityEngine.CoreModule]UnityEngine.HideFlags)
IL_005e: dup
IL_005f: call void [UnityEngine.CoreModule]UnityEngine.Object::DontDestroyOnLoad(class [UnityEngine.CoreModule]UnityEngine.Object)
IL_0064: dup
IL_0065: callvirt instance !!0 [UnityEngine.CoreModule]UnityEngine.GameObject::AddComponent<class [UnityEngine.CoreModule]UnityEngine.Camera>()
IL_006a: ldarg.2
IL_006b: newobj instance void valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>::.ctor(!0, !1)
IL_0070: stloc.0
IL_0071: ldloc.0
IL_0072: ldfld !0 valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>::Item1
IL_0077: ldc.i4.s 16
IL_0079: callvirt instance void [UnityEngine.CoreModule]UnityEngine.Camera::set_cameraType(valuetype [UnityEngine.CoreModule]UnityEngine.CameraType)
IL_007e: ldc.i4.0
IL_007f: callvirt instance void [UnityEngine.CoreModule]UnityEngine.GameObject::SetActive(bool)
IL_0084: br.s IL_0098
IL_0086: ldarg.0
IL_0087: ldfld class [netstandard]System.Collections.Generic.Stack`1<class [UnityEngine.CoreModule]UnityEngine.Camera> class UnityEngine.Rendering.HighDefinition.ProbeCameraCache`1<!K>::m_CameraPool
IL_008c: callvirt instance !0 class [netstandard]System.Collections.Generic.Stack`1<class [UnityEngine.CoreModule]UnityEngine.Camera>::Pop()
IL_0091: ldarg.2
IL_0092: newobj instance void valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>::.ctor(!0, !1)
IL_0097: stloc.0
IL_0098: ldarg.0
IL_0099: ldfld class [netstandard]System.Collections.Generic.Dictionary`2<!0, valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>> class UnityEngine.Rendering.HighDefinition.ProbeCameraCache`1<!K>::m_Cache
IL_009e: ldarg.1
IL_009f: ldloc.0
IL_00a0: callvirt instance void class [netstandard]System.Collections.Generic.Dictionary`2<!K, valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>>::set_Item(!0, !1)
IL_00a5: br.s IL_00bc
IL_00a7: ldloca.s 0
IL_00a9: ldarg.2
IL_00aa: stfld !1 valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>::Item2
IL_00af: ldarg.0
IL_00b0: ldfld class [netstandard]System.Collections.Generic.Dictionary`2<!0, valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>> class UnityEngine.Rendering.HighDefinition.ProbeCameraCache`1<!K>::m_Cache
IL_00b5: ldarg.1
IL_00b6: ldloc.0
IL_00b7: callvirt instance void class [netstandard]System.Collections.Generic.Dictionary`2<!K, valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>>::set_Item(!0, !1)
IL_00bc: ldloc.0
IL_00bd: ldfld !0 valuetype [netstandard]System.ValueTuple`2<class [UnityEngine.CoreModule]UnityEngine.Camera, int32>::Item1
IL_00c2: ret
} // end of method ProbeCameraCache`1::GetOrCreate