Wrong "Field ... is only assigned to"

2 posts, 0 answers
  1. Scott
    Scott avatar
    1 posts
    Member since:
    Jul 2014

    Posted 22 Jul 2014 Link to this post

    Public Class VnaHP8753D
        Inherits VnaBase
     
        Private _learnString As String = String.Empty
     
       Public Overrides Function GetLearnString(ByVal myChannel As Integer) As Byte()
     
    ...
     
    #If 1 Then
            _learnString = Instrument.ReadString
            Dim enc As New System.Text.ASCIIEncoding
            myBytes = enc.GetBytes(_learnString)
    #Else
    ...
    #End If
     
    ...
     
    End Function
     
    End Class
    I get the warning "Field '_learnString' is only assigned to". If I comment out the #if block I don't get the error.

    using VB2008
  2. Nikolay Valchev
    Admin
    Nikolay Valchev avatar
    72 posts

    Posted 25 Jul 2014 Link to this post

    Hello Scott,

    Thank you for the feedback!
    We reviewed you report and ascertained that the issue is caused by the preprocessor condition that you are using. We are examining '1' as if it was a predefined symbol hence the analyzer skips this code and shows the warning.
    We've just fixed this issue so you can expect it in our next release. As a temporary solution I would suggest you to ignore this warning as it is shown here.

    If you have any further questions or remarks, please do not hesitate to contact us!

    Regards,
    Nikolay Valchev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
Back to Top