Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-273333: Failed to import method

$
0
0
Reporter Joe White (joewhite) Joe White (joewhite)
Created Jun 27, 2011 7:58:54 PM
Updated Jan 21, 2012 1:59:31 AM
Priority Normal
Type Unspecified
Fix versions 6.1
State Open
Assignee Evgeny Pasynkov (pasynkov)
Subsystem No subsystem
Affected versions 6.0 EAP, 5.1.2
Fixed in build No Fixed in build
I was trying to write a simple text parser test-first, so I had the following code:

using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MyNamespace
{
    public static class ClipboardParser
    {
        public static IEnumerable<IEnumerable<string>> Parse(string text)
        {
            yield break;
        }
    }
    [TestClass]
    public class ClipboardParserTests
    {
        [TestMethod]
        public void SingleCell()
        {
            var result = ClipboardParser.Parse("foo");
            Assert.AreEqual(1, result.Count());
            Assert.AreEqual("foo", string.Join(",", result.ElementAt(0)));
        }
    }
}


When I added the calls to Count and ElementAt, I expected ReSharper to prompt me to press Alt+Enter to import the relevant namespace. (In fact, when I was first writing this code, it did – but when I re-enter the same code now, it doesn't.) However, I can put the cursor on the red Count, and I get a quick-fix light bulb; and if I press Alt+Enter, the quick-fix menu has an option for "Use method 'System.Linq.Enumerable.Count<TSource>(this IEnumerable<TSource>)'".

However, the quick-fix doesn't work. Whether it shows the prompt to press Alt+Enter to import (as it did initially, but doesn't when I re-enter the same code), or I bring up the quick-fix menu and select the option, it just gives me a tooltip that says: "Failed to import method".

If I only have the first Assert.AreEqual method, then the import works fine. So it looks like there's something about the second line that ReSharper is choking on.

This bug is present in the ReSharper 6.0 beta, but it's not new – the same bug also exists in ReSharper 5.1.2.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>