BUG: Compiler Error When You Use XmlAttribute (326706)



The information in this article applies to:

  • Microsoft Visual J# .NET (2002)

This article was previously published under Q326706

SYMPTOMS

When you compile a Visual J# .NET application that imports from both System.Xml and System.Xml.Serialization and that uses the attribute XmlAttribute, you receive the following compiler error message:
error VJS1397: Attribute 'System.Xml.XmlAttribute' doesn't inherit from 'System.Attribute'

CAUSE

The compiler confuses the class System.Xml.XmlAttribute with the attribute class System.Xml.Serialization.XmlAttributeAttribute. This occurs because both System.Xml and System.Xml.Serialization packages are imported and the short form for XmlAttributeAttribute is XmlAttribute.

RESOLUTION

To work around this problem, fully qualify the attribute class name (XmlAttributeAttribute):
	/**@attribute XmlAttributeAttribute("test")*/	
	public String helpstring;
				

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

When you compile a Visual J# .NET application that includes the following code, you receive the error message that is described in the "Symptoms" section:
import System.Xml.*;
import System.Xml.Serialization.*;

public class Class1
{
	/**@attribute XmlAttribute("test")*/	
	public String myString;
}
				

Modification Type:MajorLast Reviewed:1/27/2004
Keywords:kbbug kbpending KB326706