LINQPad 6 failed to import namespace in lambda expression

sdflysha
edited December 2019 in General

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

  • Thanks - I'll get a fix into the next build.

  • JeffMercado
    edited December 2019

    I'm not sure how to replicate without just putting all the code but I think there's some other corner cases. I think relating to the #load directive. I have a script which contains a ef core 3.1 data context and loading that in. The namespace import doesn't do anything similarly here and has to be manually entered. I'll wait for the next build to see if it gets fixed before I try replicating the issue.

    Edit:
    Ok here's an extremely cut down version.

    .Net Core 3.0
    LINQPad 6.6.1 x64

    https://www.dropbox.com/s/ayg5oncif1c7zhd/lp6-bug.zip?dl=0

    #load "Libs\EntityFramework"
    #load "Libs\InformationSchemaX"
    
    void Main()
    {
        new InformationSchemaContext // import here
    }
    
  • JeffMercado
    edited December 2019

    oops