rspec/rules/S1048/why-dotnet.adoc
2023-07-05 13:49:21 +02:00

8 lines
654 B
Plaintext

== Why is this an issue?
The {finalize-link}[{finalize-name}s] are used to perform https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals#unmanaged-resources[any necessary final clean-up] when the garbage collector is collecting a class instance.
The programmer has no control over when the {finalize-name} is called; the garbage collector decides when to call it.
When creating a {finalize-name}, it should never throw an exception, as there is a high risk of having the application terminated leaving unmanaged resources without a graceful cleanup.
The rule raises an issue on `throw` statements used in a {finalize-name}.