← back to index

S1147 — "End" statements should not be used

Language: VB.NET  |  Type: CODE_SMELL  |  Severity: Blocker

Tags: cwe, suspicious

Why is this an issue?

End statements exit the control flow of the program in an unstructured way. This statement stops code execution immediately without executing Dispose or Finalize methods, or executing Finally blocks. Therefore, it should be avoided.

Noncompliant code example

Module Module1
    Sub Print(ByVal str As String)
       Try
            ...
            End       ' Noncompliant
        Finally
            ' do something important here
            ...
        End Try
    End Sub
End Module