Do not define finalizers in types derived from MemoryManager<T>
terrajobst opened this issue · 3 comments
terrajobst commented
Adding a finalizer to a type derived MemoryManager<T>
is likely an indication of a bug, as it suggests a native resource that could have been handed out in a Span<T>
is getting cleaned up and potentially while it's still in use by the Span<T>
.
Category: Reliability
jeffhandley commented
Estimates:
- Analyzer: Small
- Fixer: Not Applicable
buyaa-n commented
Test scenarios:
- Type not derived from
MemoryManager
with or without finalizer should be OK - Type derived from
MemoryManager
without finalizer should be OK - Class directly derived from
MemoryManager
having finalizer should warn - Class indirectly derived from
MemoryManager
having finalizer should warn
buyaa-n commented
@bartonjs @terrajobst I have used warning
level for severity
and true
for isEnabledByDefault
please let me know if that is correct