Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow stack-only types in stackalloc #33951
In 16.0 preview3, we accidentally disallowed stack-only types in stackalloc. This PR restores the previous behavior.
Bugs this fixes
Workarounds, if any
Risk, Performance impact
Low. We're just skipping an unnecessary check for stackallocated arrays.
Is this a regression from a previous update?
Yes, this bug was introduced in 16.0 preview3.
Root cause analysis
While fixing an issue related to arrays, we factored some code too aggressively. The check that prevents restricted types in array types started applying to stackalloc arrays too.
How was the bug found?
Reported by customer.
Filled https://devdiv.visualstudio.com/DevDiv/_workitems/edit/815087/ for ask-mode approval.
@jaredpar I filled https://devdiv.visualstudio.com/DevDiv/_workitems/edit/815087/ for ask-mode approval.
Since we allowed stackalloc with TypedReference before, then LGTM.
However we should consider disallowing it.
And we may need to do it explicitly. Adding a field on FX side, does not seem like a solution since: