Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 840715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:40:16+00:00 2026-05-15T05:40:16+00:00

I am curious as to why I get a compiler warning in the following

  • 0

I am curious as to why I get a compiler warning in the following situation.

/// <summary>This is class A
/// </summary>
public class A
{
    /// <summary>This is the documentation for Method A
    /// </summary>
    public void MethodA()
    {
        //Do something
    }
}

/// <summary>This is class B
/// </summary>
public class B : A
{
    /// <summary>This does something that I want to
    /// reference <see cref="MethodA"/>
    /// </summary>
    public void MethodB()
    {
        //Do something
    }

}

The warning states that “XML comment on ‘B.MethodB()’ has cref attribute ‘MethodA’ that could not be resolved.” If B inherits from A shouldn’t the compiler be able to see that method when generating the documentation without me specifying the parent class in the cref? If I change the cref to be cref="A.MethodA()" it works fine, but it seems like that’s unnecessary and is a pain to do, especially if I have to go up more than one level.

As a note to anyone testing this you have to be sure to “XML documentation file” checked in the Properties -> Build in order to see the warning.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:40:17+00:00Added an answer on May 15, 2026 at 5:40 am

    If B inherits from A shouldn’t the compiler be able to see that method when generating the documentation without me specifying the parent class in the cref?

    You would think so, but this is not the case. The XMLDoc parser needs the qualification to put the method into the correct scope of the class it belongs to. If the method is part of the same class (ie. not derived from a base class), you can do without the qualification, otherwise you need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: public abstract class Test1 { public object Data { get;
I have the following Interfaces: public interface ITemplateItem { int Id { get; set;
I'm curious, how come I get 404 error running this line: urllib2.urlopen(http://localhost/new-post#comment-29) While everything
Edit: I'm really just curious as to how I can get this regex to
Curious to get people's thoughts. I conduct frequent interviews, and have had enough in
curious if anyone might have some insight in how I would do the following
I know this is wrong and gcc will give you a warning about it,
I'm curious what some reasons might be as to getting a compiler error for
Curious what the best way is in Java to get the mime-type of a
I was looking at this question and i was curious why this deosn't compile.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.