Intellisense doesn't show comments

2019-08-19 22:04发布

问题:

If I type something in VisualStudio2010 like DataSet1. I get a list of all available Methods and Properties (Intellisense). This works fine. But if I select a method or property in this list I don't get the description of if.

For Example if I have something like:

public class Dummy
{
    /// <summary>
    /// This is a test-method
    /// </summary>
    public string Do { get; set; }
}

And the usage is:

Dummy dummy = new Dummy();
dummy.Do = "dummy";

At the moment when I type dummy.Do I want to have the Property-comment to be displayed in the list of intellisense. Normally this is shown by a tooltip.

How can I turn this behavior on?

回答1:

Look in Tools > Options > Text Editor > C#. Make sure Parameter information is checked.



回答2:

  • Does the feature work for properties like String.Length? This helps determine if the problem affects all properties or just user-defined properties.

  • If class Dummy is actually part of a separate library which your project is referencing, you may need to include the XML documentation file along with the DLL assembly.

  • Do you have any Visual Studio extensions installed? Some extensions, including but not limited to ReSharper, Productivity Power Tools, and Code Contracts Editor Extensions VS2010 modify the IntelliSense presentation in ways that could impact this feature. Try disabling any extensions you have installed and restart Visual Studio to see if the problem is resolved. If the feature starts working again, you can start narrowing down the problem to find the particular extension responsible for the problem.



回答3:

zsgalusz is correct - that is how you turn it on.

If the comment is still not showing, make sure that the XML syntax (comment) is correct. VS (to my knowledge) doesn't identify errors in the syntax, so its quite easy to make a mistake and not notice it. In most cases, just one or more characters in the wrong place will cause it to not work for that method/variable/class, etc... For example:

/// <summary>
/// Adds a Platform Fee to one of the platform-fee dataGridViews.
/// </summary>
/// <param name="customFee">The Platform Fee being added.</param>
/// <param name="platformGroup">
/// DataGridView the Platform Fee is being added to.
/// 0 = existing platform dataGridView.
/// 1 = recommended platform dataGridView.
/// </param>
/// <exception cref=ArgumentException""></exception>

Looks correct right? Except ArgumetnException is not within the '"' characters thus the XML is invalid and intellisense wont show the comment.



回答4:

Make sure the XML documentation file: checkbox is checked under the Build tab in your project properties. Visual Studio will automatically add this file when you reference your DLL.