dotnet/roslyn

IDE0004 Cast is redundant false positive VB

Open

#78.185 aperta il 17 apr 2025

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-IDEFeature - IDE0004help wanted

Metriche repository

Star
 (20.414 star)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

Version Used: 17.14.0 Preview 3.0

Steps to Reproduce:

    Public Overrides Sub ProcessCommand(cmd As [Enum], arg As Object)
        MyBase.ProcessCommand(cmd, arg)
        Select Case CType(cmd, SplashScreenCommand)
            Case SplashScreenCommand.SetText
                labelStatus.Text = arg
            Case SplashScreenCommand.Close
                Close()
        End Select
    End Sub

Says the cast is reduntant however upon removing the cast I get BC30452 - Operator '=' is not defined for types '[Enum]' and 'frmSplashScreen.SplashScreenCommand'.

Expected Behavior:

Actual Behavior:

Guida contributor