简体   繁体   中英

Intelli sense not showing for custom methods with xml comments

I have an interface with XML comments on

namespace NamespaceName.Core.Services
{
    public interface ITransaction : IDisposable
    {
        /// <summary>
        /// Sends message into the given queue, optionally at the scheduled time provided
        /// </summary>
        /// <param name="queueName">Name of the queue to send message to</param>
        /// <param name="message">The message to send</param>
        /// <param name="messageId">Id of the message to send</param>
        /// <param name="enqueueDateTime">Optional date & time to enqueue the message at, MUST be in UTC</param>
        Task SendMessageAsync(string queueName, object message, string? messageId = null, DateTime? enqueueDateTime = null);
    }
}

then the method

namespace NamespaceName.Core.Services
{
  public class MessageService : IMessageService, IDisposable, IAsyncDisposable
  {
    private sealed class Transaction : ITransaction
    {
      /// <inheritdoc cref="ITransaction.SendMessageAsync(string, object, string?, DateTime?)"/>
      public async Task SendMessageAsync(string queueName, object message, 
      string? messageId = null, DateTime? enqueueDateTime = null) {...}
    }
  } 
}

when using the method I would expect to see the comments in intelli sense but they are not there, instead the message is just 'Intellicode suggestion based on the current context' 智能信息

This is in Visual Studio 2022 and I have restarted visual studio which didn't help. This works as expected in a different project in the same solution.

Any idea what needs to be done to get this to work?

(the project it works in is a console app while the one it doesn't work in is a web app incase that's of relevance)

We can see from this page( https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags#param ) that “The names for parameters must match the API signature”

In your code use queue.QueueName but in xml comment define .

In my test, if just use queueName intellisense can show prama defined in xml comments. But if I get the parameter like queue.QueueName it only shows 'Intellicode suggestion based on the current context'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM