@@ -153,15 +153,18 @@ module internal XmlDocumentation =
153153 collector.Add( Literals.dot)
154154 collector.Add( tagClass parts.[ parts.Length- 1 ])
155155
156- type XmlDocReader ( s : string ) =
157- let doc = XElement.Parse ( ProcessXml ( s ))
156+ type XmlDocReader private ( doc : XElement ) =
157+
158158let tryFindParameter name =
159159 doc.Descendants( XName.op_ Implicit" param" )
160160|> Seq.tryFind( fun el ->
161161match el.Attribute( XName.op_ Implicit" name" ) with
162162| null -> false
163163| attr-> attr.Value= name)
164164
165+ static member TryCreate ( xml : string ) =
166+ try Some( XmlDocReader( XElement.Parse( ProcessXml xml))) with _ -> None
167+
165168member __.CollectSummary ( collector : ITaggedTextCollector ) =
166169match Seq.tryHead( doc.Descendants( XName.op_ Implicit" summary" )) with
167170| None-> ()
@@ -279,12 +282,13 @@ module internal XmlDocumentation =
279282
280283interface IDocumentationBuilderwith
281284/// Append the given processed XML formatted into the string builder
282- override this.AppendDocumentationFromProcessedXML ( appendTo , processedXml , showExceptions , showParameters , paramName ) =
283- let xmlDocReader = XmlDocReader( processedXml)
284- if paramName.IsSomethen
285- xmlDocReader.CollectParameter( appendTo, paramName.Value)
286- else
287- AppendMemberData( appendTo, xmlDocReader, showExceptions, showParameters)
285+ override this.AppendDocumentationFromProcessedXML ( appendTo , processedXml , showExceptions , showParameters , paramName ) =
286+ match XmlDocReader.TryCreate processedXmlwith
287+ | Some xmlDocReader->
288+ match paramNamewith
289+ | Some paramName-> xmlDocReader.CollectParameter( appendTo, paramName)
290+ | None-> AppendMemberData( appendTo, xmlDocReader, showExceptions, showParameters)
291+ | None-> ()
288292
289293/// Append Xml documentation contents into the StringBuilder
290294override this.AppendDocumentation