/// 不为方法和函数创建摘要

/// not creating summaries for methods and functions

通常在 visual studio 类型或类型成员之前添加 /// 生成摘要。但是,当我尝试使用 /// 它只完成名称空间、类 和入口点而不是方法或函数。此问题仅发生在最近创建的解决方案中,而旧的解决方案按预期运行。

        /// <summary>
        /// Generates summary for entry point
        /// </summary>
        static void Main()
        {
           /// Doesn't generate summary.
           void ExampleVoid() {
...

我最近调整了一些 Intellisense 选项,但是,我还没有找到任何可能导致此问题的选项。

Generate XML documentation comments for /// is enabled

编辑: 我还注意到智能感知描述没有显示 , adjusting statement completion isn't fixing this.

Example of description not showing

这与Main是一个入口方法无关。

本地函数不能有文档注释。这与您不能在方法中对变量进行文档注释的原因相同,但您可以对属性进行文档注释。

您正在尝试在 Main 中声明方法 ExampleVoid。如果你想为这个方法写一个文档注释,使它成为像 Main 这样的顶级方法,并使它成为静态的,这样它就可以从静态方法中调用:

static void Main()
{
    ExampleVoid();
}

static void ExampleVoid() 
{
}