mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
A call to a value-type constructor is rewritten into "stobj(target, newobj ...)" because "Struct.ctor(target, ...)" has no C# equivalent. The rewrite keyed on TypeKind.Struct, so a struct from a missing assembly resolved as TypeKind.Unknown, fell through to the ordinary call path and produced a stack-type mismatch. Metadata cannot settle the question: a TypeRef parent carries no valuetype bit. The receiver can, though - a constructor invoked with "call" on an address is a shape only a value type has - so the unresolved case follows the receiver's stack type and steps aside where metadata does say the type is a reference type. Reading the receiver has to leave it on the stack for PrepareArguments, hence the depth-indexed peek. Assisted-by: Claude:claude-opus-5:Claude Codepull/4000/head
1 changed files with 38 additions and 8 deletions
Loading…
Reference in new issue