Suppose I have a statement:
var o = new MyObject();
when the cursor is on the MyObject() call, I have a context action that is looking for the XML Documentation of the called constructor.
So when I see the element is an IObjectCreatinExpression, I use the following code:
var reference = creationExpression.ConstructorReference;
if (reference == null) return false;
var resolveResult = reference.CurrentResolveResult;
if (resolveResult == null) return false;
var declaredElement = resolveResult.DeclaredElement;
if (declaredElement == null) return false;
var xmlNode = declaredElement.GetXMLDoc(true);
xmlNode is always null, even when I know there is XML documentation on the constructor.
I can see the XMLDocId is there, and the method above works when calling it on an IInvocationExpression.
Is there a reason it is returning null, or a better way to get the documentation?
Is it possible to get it by XmlDocId?