Namespace import incorrect in certain scenario

I'm using LINQPad 6.6.1, first, install NuGet package SharpDX.Direct2D1 latest(4.2.0) edition.

Write following code:

PixelFormat

Click triangle and showing the correct namespace import options:

But after add SharpDX.Direct2D1 as namespace import option in Query Properties window:

Note SharpDX.WIC is missing in namespace import options, which I believe should be incorrect:

Comments

  • edited December 2019

    In the first instance, LINQPad generates the list of imports by searching all accessible types in the list of referenced assemblies. In the second instance, the items are generated by a Roslyn CodeFixProvider (this is normally triggered when there's an error, usually to resolve ambiguities). It seems that there's a bug in CSharpFullyQualifyCodeFixProvider which omits SharpDX.WIC. You'll see the same thing in Visual Studio if you create a project as follows:

    <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
    
      <PropertyGroup>
         <OutputType>WinExe</OutputType>
         <TargetFramework>netcoreapp3.1</TargetFramework>
         <UseWindowsForms>true</UseWindowsForms>
         <UseWpf>true</UseWpf>
        </PropertyGroup>
    
      <ItemGroup>
         <PackageReference Include="SharpDX.Direct2D1" Version="4.2.0" />
      </ItemGroup>
    
    </Project>
    
Sign In or Register to comment.