Synopsis: | Do not access any reference type members in the finalizer |
Language: | C# |
Severity Level: | 2 |
Category: | Object lifecycle |
Description: |
When the finalizer is called by the garbage collector, it is very possible that some or all of the objects referenced by class members are already garbage collected, so dereferencing those objects may cause exceptions to be thrown. Only value type local variables can be accessed (since they live on the stack). |