BUG: IntelliSense displays namespaces with inaccessible members in Visual Basic .NET or in Visual Basic 2005 (326443)



The information in this article applies to:

  • Microsoft Visual Basic 2005 Express Edition
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)

This article was previously published under Q326443

SYMPTOMS

The IntelliSense feature in a Microsoft Visual Basic .NET project or in a Microsoft Visual Basic 2005 project displays all custom namespaces from referenced assemblies, even if the namespaces do not contain members that are accessible to the current assembly. When IntelliSense references the same assembly in a Microsoft Visual C# .NET project or in a Microsoft Visual C# 2005 project, IntelliSense only displays namespaces that contain members that are accessible to the current assembly.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a new Visual Basic .NET or Visual Basic 2005 Class Library project that is named ClassLibrary1.
  2. Replace the code in the default Class1 module with the following code:
    Namespace NoAccessibleMembers
        Friend Class FriendObject
            Sub SomeMethod()
                 'Do something here.
            End Sub
        End Class
    End Namespace
    
    Namespace AccessibleMembers
        Public Class MyObject
            Sub Test()
               'Do something here.
            End Sub
        End Class
    End Namespace
    					
  3. On the View menu, click Solution Explorer.
  4. In Solution Explorer, right-click ClassLibrary1, and then click Properties.
  5. Clear the Root Namespace property. To do this, expand the General node under the Common Properties node in the ClassLibrary1 Property Pages dialog box, delete the text in the Root namespace box, and then click OK.

    Note In Visual Studio 2005, clear the Root Namespace property in the first default page.
  6. On the File menu, click Save All.
  7. On the Build menu, click Build ClassLibrary1.
  8. On the File menu, point to New, and then click Project to create a new Visual Basic .NET Windows Application project. By default, Form1 is created.
  9. On the Project menu, click Add Reference.
  10. Click Browse, click the ClassLibrary1.dll assembly that you built in step 5, and then click Open.
  11. Click OK to close the Add Reference dialog box.
  12. Double-click in the Form window to view its Load event handler in the Code window.
  13. Type Dim x As in the Load event handler. Notice that after you type the letters "As", IntelliSense displays both the AccessibleMembers and the NoAccessibleMembers namespaces. However, IntelliSense should not display the NoAccessibleMembers namespace because it does not contain any members that are accessible to this project.

Modification Type:MajorLast Reviewed:1/21/2006
Keywords:kbvs2005applies kbvs2005swept kbvs2002sp1sweep kbbug kbnofix KB326443