Microsoft KB Archive/326443

= BUG: IntelliSense displays namespaces with inaccessible members in Visual Basic .NET or in Visual Basic 2005 =

Article ID: 326443

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Visual Basic 2005 Express Edition
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition

-



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.



Steps to Reproduce the Behavior
 Create a new Visual Basic .NET or Visual Basic 2005 Class Library project that is named ClassLibrary1.  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  On the View menu, click Solution Explorer. In Solution Explorer, right-click ClassLibrary1, and then click Properties. 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. On the File menu, click Save All.</li> On the Build menu, click Build ClassLibrary1.</li> 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.</li> On the Project menu, click Add Reference.</li> Click Browse, click the ClassLibrary1.dll assembly that you built in step 5, and then click Open.</li> Click OK to close the Add Reference dialog box.</li> Double-click in the Form window to view its Load event handler in the Code window.</li> Type Dim x As in the Load event handler. Notice that after you type the letters &quot;As&quot;, 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.</li></ol>

Keywords: kbvs2005applies kbvs2005swept kbvs2002sp1sweep kbbug kbnofix KB326443

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.