SonarLint VB: False S2589 Reported

  • Operating system: Windows 10
  • SonarLint plugin version: 7.3.0.777872
  • Programming language you’re coding in: VB, Visual Studio 2022
  • Is connected mode used: No

I recently started getting S2589 warnings.

To prevent multiple events from being processed I use the following code. Because blnInEvent is static it is not False

Static blnInEvent As Boolean

If **blnInEvent** Then Return
blnInEvent = True

' Do Something Here

Application.DoEvents()
blnInEvent = False

Another S2589 is reported for this code where there is a potential for "objNode" to be null or nothing.

objNode = tvwShortcuts.SelectedNode

If **objNode Is Nothing** Then
    Do Something Here
End If