This is a migrated thread and some comments may be shown as answers.

Wrong "Field ... is only assigned to"

1 Answer 30 Views
Code Analysis
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Scott
Top achievements
Rank 1
Scott asked on 22 Jul 2014, 12:41 PM
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

1 Answer, 1 is accepted

Sort by
0
Nikolay Valchev
Telerik team
answered on 25 Jul 2014, 09:10 AM
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.

 
Tags
Code Analysis
Asked by
Scott
Top achievements
Rank 1
Answers by
Nikolay Valchev
Telerik team
Share this question
or