Home

LINQPad 6 failed to import namespace in lambda expression

edited December 2019

My LINQPad version is 6.6.1, and I have both .NET Core 3.0 and 3.1 installed, I encountered a bug, and I simplified the code like this:

void Main()
{
    Enumerable.Range(1, 10)
        .Select(x => x.ToString())
        .Select(x => x.DoWork())
        .Dump();
}

namespace NamespaceToImport
{
    public static class ExtensionsClass
    {
        public static string DoWork(this string me)
        {
            // protend do-something here.
            return me;
        }
    }
}

Note the DoWork() function does not been imported, now I hover the red DoWork and click the down tri-angle button, the import button was successfully shown:

but when click the button, NOTHING happend, still red DoWork, still failed to compile:

I must go through Query Properties and click Namespace Imports and enter the NamespaceToImport manually and click OK to make this work:

Comments

Sign In or Register to comment.