Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-288251: Visual Basic Module With Extension

$
0
0
Reporter Alex Berezoutsky (fergard) Alex Berezoutsky (fergard)
Created Feb 10, 2012 8:01:48 PM
Updated Feb 10, 2012 8:01:48 PM
Priority Critical
Type Bug
Fix versions Next
State Submitted
Assignee Olga Lobacheva (olka)
Subsystem No subsystem
Affected versions 6.1.1
Fixed in build No Fixed in build
If you create a Visual Basic Module inside a namespace with extension methods, you need to Import that namespace in order for the methods to available in your code. ReSharper will incorrectly report this with two errors:

1) Import clause is not required by code
2) Namespace or type specified ... does not contain any public members.

Here is some sample code:

'Module file
Namespace MyNamespace
    Public Module MyExtensionModule
        <Extension()> _
        Public Function DoSomething(objToExtend As SomeObject) As SomeOtherObject
            '... do stuff
        End Function
    End Module
End Namespace


'Class that accesses it file
Imports MyNamespace
Public Class SomeClass
    Public Sub DoSomething()
        Dim obj As New SomeObject()

        'Here's the extension call.  This line will fail without the imports statement
        Dim otherObj As SomeOtherObject = obj.DoSomething()
    End Sub
End Class

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>