mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
A constant-size stackalloc initializer stores its constant elements through a data blob (cpblk from a <PrivateImplementationDetails> field). ReadElement decoded every element by width, so a 4-byte float was read as Int32 and an 8-byte double as Int64. The resulting constant carried the raw bit pattern (1f decoded as 1.0653532E+09f) and its stack type no longer matched the store, tripping StObj.CheckInvariant. Dispatch on the element's type code so Single and Double are read as floating-point, matching the heap-array decoder. Found while exploring stackalloc-initializer coverage around the element-type hint fix; floating-point element types had no test case. Assisted-by: Claude:claude-opus-4-8:Claude Codepull/3813/head
2 changed files with 27 additions and 0 deletions
Loading…
Reference in new issue