You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CMTK0005: report CollectionsMarshal.SetCount on a list of value objects #229
Found beside the CMTK0005 misses of the 2.3.1 hand check, in a scratch consumer at d573eef.
CollectionsMarshal.SetCount(list, 3) on a List<Plain> adds three default value objects, as new Plain[3] does, and nothing reports it. CMTK0005 is defined over "an array or span ... created with a length", so a list is outside it today: this widens the rule, which is why it is 2.4.0 work and not a 2.3.1 fix.
Proposal
CMTK0005 reports CollectionsMarshal.SetCount<T> where T is a value object, Option, Result or [RequireCustomInitialization] struct, unless the count is a constant zero; the README's row says "an array, span or list". A Warning reporting more needs no exception to decision 34.
Test
A CMTK0005 row for SetCount, a zero control, across TypeArgumentKinds.
Activity
CaffeinatedCoder commentedon Oct 31, 2026
Landed on
release/2.4.0by #271 (merge commit 09ec900): CMTK0005 reportsCollectionsMarshal.SetCounton a list of value objects.