Writing custom visualizer for Linqpad 6

I want to upgrade my custom visualizer to support LINQPad 6 and have some questions about it. Currently it references LINQPad nuget. Do I need to now reference LINQPad.Runtime instead?

Is there a way to support both LINQPad 5 and 6 from a single nuget package ?


  • edited January 12

    Add a reference to the LINQPad.Reference NuGet package - this contains reference assemblies for both versions of LINQPad.

    To create a NuGet package that works for both LINQPad 5 and 6, you must instruct VS to include assemblies for both .NET Framework (for LINQPad 5) and .NET Core (for LINQPad 6). Start by creating a multi-targeting project as follows:

    <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
        <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
            <PackageReference Include="LINQPad.Reference" Version="1.*" />
        <ItemGroup Condition="'$(TargetFramework)' == 'net46'">
            <Reference Include="System.Xaml">
            <Reference Include="WindowsBase" />
            <Reference Include="PresentationCore" />
            <Reference Include="PresentationFramework" />

    When you build, VS will automatically create a NuGet package whose lib folder contains both net46 and netcoreapp3.0 subfolders (net46 for LINQPad 5 and netcoreapp3.0 for LINQPad 6).

    If you need to do anything differently for LINQPad 5 vs 6, use the conditional compilation symbol defined in the project file above (NETCORE).

  • Does the above approach works if I want to use WinForms instead of Wpf?

  • edited January 14

    Yes: add


    to your project file and add net46 references to System.Drawing and System.Windows.Forms.

  • What is object that is returned by Util.CurrentDataContext ? Previously it was DataContextBase but that type is missing from the .net core version of the LINQPad.Reference library.

  • edited January 14

    In LINQPad 6, the built-in data context drivers have been completely decoupled from the runtime, so LINQPad.Runtime now has no concept of DataContextBase (which was based on LINQ-to-SQL's DataContext class).

    A benefit of this decoupling is that Util.CurrentDataContext now works for queries that use a different driver. For example if your query uses the built-in Entity Framework Core driver, Util.CurrentDataContext will return a DbContext object (whereas in LINQPad 5, it would return null). The same applies for third-party drivers.

    If you want to access properties of Util.CurrentDataContext, the safest option is to use dynamic binding or reflection.

  • I see. How does Linq to SQL work in Linqpad 6 ? As I saw it's not supported by .net core

  • That's right - they removed LINQ-to-SQL for .NET Core. LINQPad uses a forked version:

  • I guess there is no NuGet package for it right ?

  • There's no NuGet package. Is there a scenario that you can't easily solve with dynamic binding?

  • The current version of my visualizer depends on System.Data.Linq so I would need to make some changes to make it work again with dynamic binding

  • Let me know if you run into any blocking issues with dynamic binding (such as having to implement an interface).

Sign In or Register to comment.