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 translations Article translations
Article ID: 891516 - View products that this article applies to.
Expand all | Collapse all

On This Page

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 "Applies to" section.

MORE INFORMATION

Steps to reproduce this problem:

  1. Start Microsoft Visual Studio .NET 2003.
  2. On the File menu, click New, click Project, click Visual C# Projects, click Class Library, and then click OK.
  3. In Solution Explorer, right-click Class1.cs, and then rename the file as Webcontrols.cs.
  4. 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;
    		}
    	}
    }
  5. On the File menu, click Save ClassLibrary1 As.
  6. Save the file as DriveLetter:\Path\ClassLibrary1, and then quit Visual Studio .NET 2003.
  7. Start Microsoft Visual Studio .NET 2003.
  8. On the File menu, click New, click Project, click Visual Basic Projects, click Console Application, and then click OK.
  9. In Solution Explorer, right-click References, click Add Reference, click Browse, locate the ClassLibrary1.dll file in the DriveLetter:\Path\Bin\Debug folder, and then click OK.
  10. 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
    
  11. On the File menu, click Add Project, click New Project, click Visual C# Projects, click Console Application, and then click OK.
  12. In Solution Explorer, expand CosoleApplication2, right-click References, click Add Reference, click Browse, locate the ClassLibrary1.dll file in the DriveLetter:\Path\Bin\Debug folder, and then click OK.
  13. 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;
    		}
    	}
    }
  14. On the Debug menu, click Start. You will notice the breakpoint move to the next line.
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

Properties

Article ID: 891516 - Last Review: May 15, 2006 - Revision: 2.1
APPLIES TO
  • Microsoft Visual Studio .NET 2003 Professional Edition
Keywords: 
kbqfe kbdevstudio kbdev kbfix kbbug kbhotfixserver KB891516

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com