0

Usually in visual studio adding /// before a type or type member generates a summary. However, when I try using /// it only completes namespaces, classes and entry points not methods or functions. This issue only occurs in recently created solutions with older ones behaving as expected.

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

I have recently adjusted some Intellisense options however, I haven't found any options that would have caused this.

Generate XML documentation comments for /// is enabled

Edit: I've also noticed that intellisense descriptions aren't showing for methods or system classes, adjusting statement completion isn't fixing this. Reinstalling the framework may be the solution.

Example of description not showing

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
DaemonFire
  • 573
  • 6
  • 13
  • The code was meant to illustrate what /// auto generated and what it did not. In this case /// autogenerated for the entry point creating the . /// didnt autogenerate a summary for void ExampleVoid(). If I were to do this in a older solution /// would have auto generated a summary with an opening and closing statement. – DaemonFire Dec 09 '19 at 01:39

1 Answers1

2

This has nothing to do with Main being an entry method.

Local functions can't have doc-comments. It's the same reason you can't doc-comment variables in a method, but you can doc-comment properties.

You are trying to declare the method ExampleVoid inside Main. If you want to write a doc-comment for this method, make it a top-level method like Main, and make it static so it can be called from a static method:

static void Main()
{
    ExampleVoid();
}

static void ExampleVoid() 
{
}