Skip to content

Commit 528287c

Browse files
committed
update documentation
fix #427
1 parent ada6a9e commit 528287c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

documentation/IDISP023.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Don't use reference types in finalizer context.
1616

1717
## Motivation
1818

19-
Any use of reference types from a finalizer is hazardous. When that finalizer was invoked as part of AppDomain shutdown, the CLR makes no guarantee regarding order of finalization or GC for a typical finalizer, and thus any access to a reference type (other than strictly this) could AV and crash the process. The only safe activity from a finalizer is accessing value types and calling p/invoke methods, which limits safe activity to calling into native code to release resources. Even accessing SafeHandles is unsafe, which is why these types have their own finalizers rather than relying on their owners to dispose of them during finalization.
19+
Any use of reference types from a finalizer is hazardous.
20+
When that finalizer was invoked as part of AppDomain shutdown, the CLR makes no guarantee regarding order of finalization or GC for a typical finalizer, and thus any access to a reference type (other than strictly this) could access violation and crash the process. The only safe activity from a finalizer is accessing value types and calling p/invoke methods, which limits safe activity to calling into native code to release resources. Even accessing SafeHandles is unsafe, which is why these types have their own finalizers rather than relying on their owners to dispose of them during finalization.
2021

2122
## How to fix violations
2223

0 commit comments

Comments
 (0)