ITreeNode.GetContainingFile() is returning null after last SDK update

After upgrading to the latest SDK (JetBrains.ReSharper.SDK version=2017.1.20170407.131329), ITreeNode.GetContainingFile() as well as .GetDocumentRange() is returning null. This didn't use to happen. Is this a bug or is there another way to get "DocumentRange" for a ITreeNode?

0
3 comments

Please, provide test case where such situation happens.

0

So this is the code that the plugin runs against:

namespace TestClassLibrary.Business
{
public enum AddressType
{
Home = 0,
Work = 1,
Other = 2
}
}

It is in a file called "AddressType.cs"

When the cursor selects the enum name "AddressType"...

The plugin code runs:

Snippet

protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
     var enumDeclaration = _provider.GetSelectedElement<IEnumDeclaration>(true, true);Snippet
    var document = enumDeclaration.GetDocumentRange().Document;
...
}

document is resulting in null since the last SDK update, because internally it is calling:

enumDeclaration.GetContainingFile() 

which also is returning null now (but didn't used to).

 

 

0

John, what is _provider? Better, to provide full sources of plugin so I can check without guessing.

0

Please sign in to leave a comment.