rspec/rules/S1048/vbnet/rule.adoc

44 lines
1.0 KiB
Plaintext
Raw Normal View History

2020-06-30 12:47:33 +02:00
If Finalize or an override of Finalize throws an exception, and the runtime is not hosted by an application that overrides the default policy, the runtime terminates the process immediately without graceful cleanup (finally blocks and finalizers are not executed). This behavior ensures process integrity if the finalizer cannot free or destroy resources.
2021-02-02 15:02:10 +01:00
2020-06-30 12:47:33 +02:00
The rule reports on throw statements used in finalizers.
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,vbnet]
2020-06-30 12:47:33 +02:00
----
Class MyClass
Protected Overrides Sub Finalize()
Throw New NotImplementedException() ' Noncompliant
End Sub
End Class
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,vbnet]
2020-06-30 12:47:33 +02:00
----
Class MyClass
Protected Overrides Sub Finalize()
' No throw
End Sub
End Class
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]