none
Warning CA1303 (FxCop) How to fix this RRS feed

  • Question

  • Hello,

    Please Help me to find fix for below example. Warning CA1303 (FxCop)

    Sample Code: 

        Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
            If K9Core.CheckInternetConn = True Then
                tsslblIntSta.ForeColor = Color.Green
                tsslblIntSta.Text = "ONLINE"                      'Warning CA1303
            ElseIf K9Core.CheckInternetConn = False Then
                tsslblIntSta.ForeColor = Color.Red
                tsslblIntSta.Text = "OFFLINE"                     'Warning CA1303
            End If
        End Sub

    And also I need to know, Can I ignore these FxCop Warning. is that ok with Application structure

     

    Thank you...

    Rohan!~


    RohanD


    • Edited by RAT_SL Wednesday, August 7, 2019 7:44 PM
    Wednesday, August 7, 2019 7:18 PM

All replies


  • Please Help me to find fix for below example. Warning CA1303 (FxCop)


        Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
            If K9Core.CheckInternetConn = True Then
                tsslblIntSta.ForeColor = Color.Green
                tsslblIntSta.Text = "ONLINE"                      'Warning CA1303
            ElseIf K9Core.CheckInternetConn = False Then
                tsslblIntSta.ForeColor = Color.Red
                tsslblIntSta.Text = "OFFLINE"                     'Warning CA1303
            End If
        End Sub

     Can I ignore these FxCop Warning. is that ok with Application structure


    Did you read the help for that warning?

    CA1303: Do not pass literals as localized parameters
    https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1303-do-not-pass-literals-as-localized-parameters?view=vs-2019

    - Wayne

    Wednesday, August 7, 2019 11:51 PM

  • And also I need to know, Can I ignore these FxCop Warning. is that ok with Application structure


    Whether or not you can or should ignore or disable some of these Warnings
    depends on what you intend to do with your program. Is it going to be
    distributed to others? If so, will these others always be using the same
    locale (Culture) as you are using? Or will they be in different locales?

    In short, is globalization of your application an important consideration
    or requirement? If not then you can safely ignore or disable many of these
    Warnings.

    Read the Help for these CAxxxx Warnings and make an informed decision.
    We can't do that for you.

    - Wayne

    Thursday, August 8, 2019 12:28 AM