ejball / XmlDocMarkdown

Generates Markdown from .NET XML documentation comments.
https://ejball.com/XmlDocMarkdown/
MIT License
102 stars 30 forks source link

Method definition lacks "async" modifier #129

Closed maurizuki closed 1 year ago

maurizuki commented 1 year ago

Hi! the method definition lacks the "async" modifier for asynchronous methods, for example a method defined as:

public async Task<string> MyFunc(string input)

is rendered like:

public Task<string> MyFunc(string input)

I found this code snippet that should be useful:

public static bool IsAsync(this MethodInfo m)
{
    return m?
        .GetCustomAttribute<AsyncStateMachineAttribute>()?
        .StateMachineType?
        .GetTypeInfo()
        .GetCustomAttribute<CompilerGeneratedAttribute>()
        != null;
}

KR

ejball commented 1 year ago

Thanks for the suggestion! However, whether a method uses the async modifier has no impact on the caller. It is purely an implementation detail and therefore not appropriate for API documentation, in my opinion. Note that learn.microsoft.com also does not include that keyword when documenting method signatures.