Using AddXmlDocComputed in a F # Type Provider

I have a type provider that provides a static property, but the documentation can change at repeated intervals. I have the following property setting.

let prop = ProvidedProperty("Test", typeof<string>,
                            IsStatic = true,
                            GetterCode = fun args -> <@@ "Test" @@>)

Then I tried to add some documentation to it with the AddXmlDocComputedfollowing

let GetDocumentation () = "Test documentation"

do prop.AddXmlDocComputed(GetDocumentation)

However, in the Intellisense comments I am not getting the text. Then I threw an exception in the function GetDocumentation, which is reflected in intellisense by adding [<Note>]and reporting that it came from a call GetDocumentation. I also tried using AddXmlDocand AddXmlDocDelayed, both of which added documentation as expected.

So this leads to my question: does anyone have any experience using it AddXmlDocComputedand why is my current implementation not adding documentation to the property?

Edit:
Now I tried debugging the VS2013 instance and see that the documentation is being called and the expected string is being passed through the type provider for this property, however, there is still no documentation in the Intellisense window.

+4
source share
1 answer

, ProvidedTypes.fs. , XML doc , GetCustomAttributesData() type CustomAttributesImpl(). , , ( ).

, :

member __.GetCustomAttributesData() = 
    [| yield! customAttributesOnce.Force()
       match xmlDocAlwaysRecomputed with None -> () | Some f -> yield mkXmlDocCustomAttributeData (f())  |]
    :> IList<_>

GitHub .

FSharp.TypeProviders.StarterPack.

0

Source: https://habr.com/ru/post/1532474/


All Articles