-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CS1584+CS1658/CS0081 when using constructed generic types in XML comments #401
Comments
Constructed generic types are not supported in XML documentation, to my irritation. |
I'm trying to work out phrasing that inform unexperienced developers that asynchronous methods return a |
I'm not sure if this is intended as a language proposal, a language question, or if it belongs in the Roslyn repo as a comment about the behavior of the compiler. |
Neither do I! Should that be wrong? What does the spec say about that? |
This is definitely a pain point. I would love to see support for this. |
Currently the compiler does not allow a documentation comment to directly reference an instantiated generic type. For the purpose of hyperlinking in the resulting documentation, this seems to make sense. However, documentation includes more than just a simple hyperlink. I can certainly see value in the ability to reference an instantiated generic type which displays using the type as-referenced, but links to the original type definition. From what I can tell, the spec neither requires nor forbids this ability. I believe it would make sense to formalize the desired behavior as a language proposal prior to implementing it within one specific compiler. |
As far as hyperlinking goes, I'd assume it would hyperlink to the |
@jnm2 Yes, that's what I meant by linking to the original type definition. |
I does allows |
Thought a documentation generator could be free to, if it wanted, insert links inside links exactly as what happens when you'd go to definition in the IDE: @paulomorgado It actually doesn't allow |
⚡️ 💡 Now it makes sense why it's doing what's doing. But it should be fixed. |
The current SandCastle help compiler already does the desired thing for constructed generic types when they are read from the assembly and not from the doc comment. E.g. a return type of |
@EWSoftware I'm interested in implementing a prototype of this feature. Given a reference like the following, do you have any thoughts regarding an output syntax which would work well with SHFB? Modification to SHFB will probably be necessary eventually, but I'm curious about what would be easiest to accommodate.
📝 This would likely render in documentation as:
Dictionary<string, List<object>>
|
Wouldn't you have to escape at least the |
@HaloFour Yes that was an oversight. Corrected in my example. |
I've really wanted this for a while, but now that I think about it: 💭 Is there also something that could be done for partially constructed generic types? So given for example
would |
@sharwell
It would get rewritten to the XML comments file as:
If a type parameter is given instead of a type (i.e. That's effectively what you have to do now by hand if you want it to read that way in the topic. Since it's just a series of |
If it's not possible to change |
@paulomorgado I believe @EWSoftware was talking about the form of a |
@sharwell, yes, I understood it. But changing that requires that the tool that you use changes to account for that. If that's not possible, we should come up with a convention to document constructed or partially constructed types. This is good enough for C#, but not for F#, VB or any other language:
|
Currently,
The generic parameters are actually omitted. It would be interesting to emit the following for a constructed generic type:
|
Similar Issue /// <summary>
/// Executes the specified <see cref="Func{Task{TResult}}"/> asynchronously on the
/// thread that the Dispatcher was created on
/// </summary>
/// <typeparam name="TResult">The type of retur value of <paramref name="action"/></typeparam>
/// <param name="action">
/// A <see cref="Func{Task{TResult}}"/> delegate to invoke through the dispatcher.
/// </param>
/// <param name="priority">
/// The priority that determines in what order the specified
/// callback is invoked relative to the other pending operations
/// in the Dispatcher.
/// </param>
/// <returns>
/// An task that completes after the task returned from callback finishes
/// </returns>
public Task<TResult> InvokeAsync<TResult>(Func<Task<TResult>> action, DispatcherPriority priority = default)
{
...
} |
This code:
Generates 4 CS1658 warning caused by a CS0081 error in the comment line warnings both in VS2015 and VS2017 and an extra CS1584 warning in VS2017.
By the way, where is the documentation for these errors/warnings?
The text was updated successfully, but these errors were encountered: