Microsoft KB Archive/891516

= FIX: When Visual Basic .NET inherits an interface name from a class that has multiple inheritances and the interface has the same name, Visual Basic .NET does not generate code in Visual Studio .NET 2003 =

Article ID: 891516

Article Last Modified on 5/15/2006

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Professional Edition

-





SYMPTOMS
When you debug Microsoft Visual Basic .NET code in the Microsoft Visual Studio .NET 2003 IDE, code that accesses the properties and the methods of the base interface is skipped. The Microsoft intermediate language (MSIL) in the MSIL Disassembler (Ildasm.exe) code shows that the MSIL code is not generated for the corresponding Visual Basic .NET source. You experience this problem when the following two conditions are true:
 * The Microsoft Visual Basic .NET class inherits an interface from a class that has multiple inheritances.
 * The inherited interface has the same name.

Note An exception occurs on the line after the missing code. The expected behavior is that the MSIL generates the missing following code: str = tab.AccessKey



CAUSE
This problem occurs because Visual Basic .NET does not generate the required code. When Visual Basic .NET assemblies and Microsoft Visual C# assemblies have a single inheritance hierarchy but have duplicate interface names, Visual Basic does not generate code when you access the base interface methods or attributes.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Visual Studio .NET 2002 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.  Date         Time   Version      Size       File name - 21-Dec-2004  22:44  7.10.4348.0    598,016  Bcaut.dll 22-Dec-2004 02:35  7.10.4348.0  1,437,696  Msvb7.dll



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce this problem:
 Start Microsoft Visual Studio .NET 2003. On the File menu, click New, click Project, click Visual C# Projects, click Class Library, and then click OK. In Solution Explorer, right-click Class1.cs, and then rename the file as Webcontrols.cs.  In Solution Explorer, double-click Webcontrols.cs, and then replace all the code that is provided in Webcontrols.cs with the following code using System;

namespace WebControls.WebControl {   public interface IServerIM {       string AccessKey {           get; set; }   } }

namespace WebControls.Navigation.NavigationSet {   public interface IServerIM : WebControls.WebControl.IServerIM {       short SelectedIndex {           get; set; }   } }

namespace WebControls.Tab.Tab {   public interface IServerIM : WebControls.Navigation.NavigationSet.IServerIM {       string StringName {           get; set; }   } }  On the File menu, click Save ClassLibrary1 As.</li> Save the file as :\ \ClassLibrary1, and then quit Visual Studio .NET 2003.</li> Start Microsoft Visual Studio .NET 2003.</li> On the File menu, click New, click Project, click Visual Basic Projects, click Console Application, and then click OK.</li> In Solution Explorer, right-click References, click Add Reference, click Browse, locate the .dll file in the  :\ \Bin\Debug folder, and then click OK.</li>  In Solution Explorer, double-click Module1.vb, and then replace all the code that is provided in Module1.vb with the following code example: Imports WebControls

Module Module1

Sub Main Dim tab As WebControls.Tab.Tab.IServerIM = Nothing

Dim str As String str = tab.AccessKey ' <--- No code generated ! 'Set a BreakPoint to the previous line and you will notice that the breakpoint moves to the next line. str = tab.StringName

End Sub

End Module </li> On the File menu, click Add Project, click New Project, click Visual C# Projects, click Console Application, and then click OK.</li> In Solution Explorer, expand CosoleApplication2, right-click References, click Add Reference, click Browse, locate the .dll file in the  :\ \Bin\Debug folder, and then click OK.</li>  In Solution Explorer, double-click Class1.cs, and then replace all the code that is provided in Class1.cs with the following code sample: using System; using WebControls;

namespace ConsoleApplication2 {   class Class1 {       [STAThread] static void Main(string[] args) {           WebControls.Tab.Tab.IServerIM tab = null;

string str; str = tab.AccessKey; str = tab.StringName; }   } } </li> On the Debug menu, click Start. You will notice the breakpoint move to the next line.</li></ol>

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

Keywords: kbbug kbfix kbqfe kbdevstudio kbdev kbhotfixserver KB891516

-

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

© Microsoft Corporation. All rights reserved.