By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,673 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,673 IT Pros & Developers. It's quick & easy.

XML comment problem with [ClassInterfaceAttribute(...

P: n/a
Using XML comments with the following code works correctly:

using System;
using System.Runtime.InteropServices;
namespace test
{
//[ClassInterfaceAttribute(ClassInterfaceType.AutoDua l)]
/// <summary>Summary description for temp1.</summary>
public class temp1
{
/// <summary></summary>
public temp1() {}
}
}

However, if I uncomment the "//[ClassInterfaceAttribute" line, I get
the following XML comment build errors:

XML comment is not placed on a valid language element
Missing XML comment for publicly visible type or member 'test.temp1'

I need to specify the [ClassInterfaceAttribute so that I can use this
class as a COM component.

Any ideas on how to get XML comments as well as COM Interop??

Thanks,
Rick Webster
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I suspect that you'd need your comments above the attribute and not below
it.
-chris

On 9 Jul 2003 08:24:19 -0700, RickyJack <Ri********@att.net> wrote:
Using XML comments with the following code works correctly:

using System;
using System.Runtime.InteropServices;
namespace test
{
//[ClassInterfaceAttribute(ClassInterfaceType.AutoDua l)]
/// <summary>Summary description for temp1.</summary>
public class temp1
{
/// <summary></summary>
public temp1() {}
}
}

However, if I uncomment the "//[ClassInterfaceAttribute" line, I get
the following XML comment build errors:

XML comment is not placed on a valid language element
Missing XML comment for publicly visible type or member 'test.temp1'

I need to specify the [ClassInterfaceAttribute so that I can use this
class as a COM component.

Any ideas on how to get XML comments as well as COM Interop??

Thanks,
Rick Webster


--
Chris J. Breisch, MCSD.NET, MCDBA
Nov 13 '05 #2

P: n/a
Reverse the order of the XML comment and the attribute. Quoting from the
language spec (Appendix B) "They must immediately precede a user-defined
type (such as a class, delegate, or interface) or a member (such as a field,
event, property, or method) that they annotate. Attribute sections (17.2)
are considered part of declarations, so documentation comments must precede
attributes applied to a type or member."

So your code should look like this:
using System;
using System.Runtime.InteropServices;
namespace test
{
/// <summary>Summary description for temp1.</summary>
[ClassInterfaceAttribute(ClassInterfaceType.AutoDua l)]
public class temp1
{
/// <summary></summary>
public temp1() {}
}
}
--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"RickyJack" <Ri********@att.net> wrote in message
news:76**************************@posting.google.c om...
Using XML comments with the following code works correctly:

using System;
using System.Runtime.InteropServices;
namespace test
{
//[ClassInterfaceAttribute(ClassInterfaceType.AutoDua l)]
/// <summary>Summary description for temp1.</summary>
public class temp1
{
/// <summary></summary>
public temp1() {}
}
}

However, if I uncomment the "//[ClassInterfaceAttribute" line, I get
the following XML comment build errors:

XML comment is not placed on a valid language element
Missing XML comment for publicly visible type or member 'test.temp1'

I need to specify the [ClassInterfaceAttribute so that I can use this
class as a COM component.

Any ideas on how to get XML comments as well as COM Interop??

Thanks,
Rick Webster

Nov 13 '05 #3

P: n/a
"Grant Richins [MS]" <gr*****@online.microsoft.com> wrote in message news:<Oq**************@TK2MSFTNGP10.phx.gbl>...
Reverse the order of the XML comment and the attribute...


Thanks for the help! Reversing the lines worked. I guess I should have
tried that but I was under the assumption that the XML comment stuff
had to be directly before the class definition.

Regards,
Rick Webster
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.