Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Incorrect ResolveResult for Generic objects

$
0
0

Hi,

I am using NRefactoryResolver to parse cs and vb code. Recently, I upgraded NRefactory dll from 3.2 to 4.4.1. I am not getting correct ResolveResult object for following statements in 4.4.1, which I was getting correctly using 3.2

string b="test";

LinkedList<string> sentence = new LinkedList<string>();
            sentence.AddFirst(b);
            LinkedListNode<string> cur = sentence.FindLast(b);
            string s = b.ToString();
            string c = cur.ToString();

When I parse line string s = b.ToString(), I get the resolveResult for InvocationExpression (b.ToString()) as MemberResolveResult, and that of its target object (b) as MethodGroupResolveResult. This MethodGroupResolveResult has 2 or 3 methds in its Methods list, one of which points to override ToString() method. Thus I get the correct ResolveResult for invocationExpression (b.ToString()).

However for the invocation at the next statement (cur.ToString()),the resolveResult received from NrefactoryResolver.ResolverInternal() method is UnknownMethodResolve() type. The ResolveResult of its target object (cur), is MethodGroupResolveResult. But this MethodGroupResolveResult has only one method in its list, with property IsExtension() as true, which results in UnknownMethodResolveResult for the invocation expression (cur.ToString())

When I use NrefactoryResolver 3.2, I get the correct type for both - invocation expression (cur.ToString()) as MemberResolveResult, as well as its target object (cur) as MethodGroupResolveResult with two methods in the list (one with override ToString()) signature.

 

Please guide me on how to get the correct ResolveResult() type for cur.ToString() statement using updated NrefactoryResolver.

 

Thanks,

Manjeet Singh

 A small update - It does not give the correct type if the target version of the project on which the resolver is running is set to .Net framework 3.5. However, if the target framework is .net framework 3.5,  NRefactory.Resolver method does not give correct type for cur.ToString()


Viewing all articles
Browse latest Browse all 1764

Trending Articles