False Error in VB code analysis

I'm working with build 2080. Given the following code:

    Public Const MY_CONST As Integer = 47
    Private MyVar As Integer

    Public ReadOnly Property MyProperty() As Integer
        Get
            Return MyVar
        End Get
    End Property


    Public Sub SomeFunction(ByRef value As Integer)
        'Do Something with value...
        My.Computer.Clipboard.SetText(value)
    End Sub



    Public Sub SomeOtherFunction()
        SomeFunction(MyProperty)
        SomeFunction(MY_CONST)
    End Sub


R# mark the error "Property MyProperty has no setter" on "MyProperty"  and "Constant cannot be used as assignement target" on "MY_CONST" in the calls of "SomeFunction". This is semantically correct, but Visual Basic accepts such constructs and the code is compiled without error. I would prefer to flag such constructs as warning, but there is no possibility to change the severity of this exception (specially because i have to call functions with ByRef parameters for which i don't have the source code and so not be able to change the signature).

Another thing is that R# marks "My.Computer...." as error "Cannot resolve symbol Computer". Same error occurs for My.Application. So it seems that code analysis doesn't recognize the My namespace.

Third annoying false error is that R# doesn't recognize the With keyword. Each reference of a method or property inside the With-block  is marked with the Error "Cannot resolve symbol...".

Regards
Klaus

Added problem with "With" keyword

1 comment

Hello Klaus,

Thank you for reporting this problem! I've filed a bug-report here: http://youtrack.jetbrains.net/issue/RSRP-208938.
As to unresolved My.Computer, this is a known problem and we will do our
best to fix it soon.

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I'm working with build 2080. Given the following code:

Public Const MY_CONST As Integer = 47
Private MyVar As Integer
Public ReadOnly Property MyProperty() As Integer
Get
Return MyVar
End Get
End Property
Public Sub SomeFunction(ByRef value As Integer)
'Do Something with value...
My.Computer.Clipboard.SetText(value)
End Sub
Public Sub SomeOtherFunction()
SomeFunction(MyProperty)
SomeFunction(MY_CONST)
End Sub
R# mark the error "Property MyProperty has no setter" on "MyProperty"
and "Constant cannot be used as assignement target" on "MY_CONST" in
the calls of "SomeFunction". This is semantically correct, but Visual
Basic accepts such constructs and the code is compiled without error.
I would prefer to flag such constructs as warning, but there is no
possibility to change the severity of this exception (specially
because i have to call functions with ByRef parameters for which i
don't have the source code and so not be able to change the
signature).

Another thing is that R# marks "My.Computer...." as error "Cannot
resolve symbol Computer".

Regards
Klaus
---
Original message URL:
http://devnet.jetbrains.net/message/5284706#5284706



0

Please sign in to leave a comment.