Microsoft KB Archive/326706

= BUG: Compiler Error When You Use XmlAttribute =

Article ID: 326706

Article Last Modified on 1/27/2004

-

APPLIES TO


 * Microsoft Visual J# .NET 2003 Standard Edition

-



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(&quot;test&quot;)*/ 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.



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 &quot;Symptoms&quot; section: import System.Xml.*; import System.Xml.Serialization.*;

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

Additional query words: vjsharp jsharp j# xml attribute vjs1397

Keywords: kbbug kbpending KB326706

-

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

© Microsoft Corporation. All rights reserved.