fsharp
fsharp copied to clipboard
No description is provided for a completion item with a quote in its name
DeclarationListItem.Description fails to provide any info for items that contain quotes in their names due to an exception:
CompositionError "internal error: 'doc/members/member[@name='M:FSharpx.StringModule.normalize'(System.Text.NormalizationForm,System.String)']' has an invalid token.
Stack Trace
System.Xml.XPath.XPathException: 'doc/members/member[@name='M:FSharpx.StringModule.normalize'(System.Text.NormalizationForm,System.String)']' has an invalid token.
at MS.Internal.Xml.XPath.XPathParser.CheckToken(LexKind t)
at MS.Internal.Xml.XPath.XPathParser.ParsePredicate(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseStep(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseRelativeLocationPath(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParsePathExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseUnionExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseMultiplicativeExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseAdditiveExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseRelationalExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseEqualityExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseAndExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseOrExpr(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseExpresion(AstNode qyInput)
at MS.Internal.Xml.XPath.XPathParser.ParseXPathExpresion(String xpathExpresion)
at System.Xml.XPath.XPathExpression.Compile(String xpath, IXmlNamespaceResolver nsResolver)
at System.Xml.XPath.XPathNavigator.Select(String xpath)
at System.Xml.XmlNode.SelectNodes(String xpath)
at System.Xml.XmlNode.SelectSingleNode(String xpath)
at <StartupCode$FSharp-Compiler-Service>[email protected](XmlDocument doc) in C:\Developer\fsharp\src\fsharp\XmlDoc.fs:line 285
at FSharp.Compiler.Xml.XmlDocumentationInfo.TryGetXmlDocBySig(String xmlDocSig) in C:\Developer\fsharp\src\fsharp\XmlDoc.fs:line 291
at FSharp.Compiler.Symbols.SymbolHelpers.GetXmlDocFromLoader(InfoReader infoReader, FSharpXmlDoc xmlDoc) in C:\Developer\fsharp\src\fsharp\symbols\SymbolHelpers.fs:line 420
at FSharp.Compiler.Symbols.SymbolHelpers.GetXmlCommentForItem(InfoReader infoReader, Range m, Item item) in C:\Developer\fsharp\src\fsharp\symbols\SymbolHelpers.fs:line 691
at FSharp.Compiler.EditorServices.DeclarationListHelpers.FormatItemDescriptionToToolTipElement(Boolean displayFullName, InfoReader infoReader, AccessorDomain ad, Range m, DisplayEnv denv, ItemWithInst item) in C:\Developer\fsharp\src\fsharp\service\ServiceDeclarationLists.fs:line 152
at FSharp.Compiler.EditorServices.DeclarationListHelpers.FormatStructuredDescriptionOfItem@456.Invoke(Unit unitVar0) in C:\Developer\fsharp\src\fsharp\service\ServiceDeclarationLists.fs:line 456
at FSharp.Compiler.Diagnostics.ErrorScope.Protect[a](Range m, FSharpFunc`2 f, FSharpFunc`2 err) in C:\Developer\fsharp\src\fsharp\symbols\SymbolHelpers.fs:line 147
"
An easy repro is referencing FSharpx.Extras and trying to use functions from it:
Related https://github.com/dotnet/fsharp/issues/11598
In this:
match doc.SelectSingleNode(sprintf "doc/members/member[@name='%s']" xmlDocSig) with
Looks like we're missing XML escapes:
double quotes ( " ) are escaped to "
ampersand ( & ) is escaped to &
single quotes ( ' ) are escaped to '
less than ( < ) is escaped to <
greater than ( > ) is escaped to >
Not sure if it's the computation of the xmlDocSig that's incorrect, or the composition of the XPath query