CS1584+CS1658/CS0081 when using constructed generic types in XML comments #8986
Replies: 22 comments
-
Constructed generic types are not supported in XML documentation, to my irritation. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to work out phrasing that inform unexperienced developers that asynchronous methods return a |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Neither do I! Should that be wrong? What does the spec say about that? |
Beta Was this translation helpful? Give feedback.
-
This is definitely a pain point. I would love to see support for this. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
As far as hyperlinking goes, I'd assume it would hyperlink to the |
Beta Was this translation helpful? Give feedback.
-
@jnm2 Yes, that's what I meant by linking to the original type definition. |
Beta Was this translation helpful? Give feedback.
-
I does allows |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
⚡️ 💡 Now it makes sense why it's doing what's doing. But it should be fixed. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
@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>>
|
Beta Was this translation helpful? Give feedback.
-
Wouldn't you have to escape at least the |
Beta Was this translation helpful? Give feedback.
-
@HaloFour Yes that was an oversight. Corrected in my example. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
@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 |
Beta Was this translation helpful? Give feedback.
-
If it's not possible to change |
Beta Was this translation helpful? Give feedback.
-
@paulomorgado I believe @EWSoftware was talking about the form of a |
Beta Was this translation helpful? Give feedback.
-
@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:
|
Beta Was this translation helpful? Give feedback.
-
Currently,
The generic parameters are actually omitted. It would be interesting to emit the following for a constructed generic type:
|
Beta Was this translation helpful? Give feedback.
-
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)
{
...
} |
Beta Was this translation helpful? Give feedback.
-
Champion issue: #8988
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?
Beta Was this translation helpful? Give feedback.
All reactions