Skip to main content
A newer version of this page is available. .

InvalidOperationException

If you use Blazor WebAssembly Data Grid (DxDataGrid<T>), you may see the following exception in a browser:

System.InvalidOperationException: No generic method ‘Take’ on type ‘System.Linq.Queryable’ is compatible with the supplied type arguments and arguments.

To resolve this issue, do one of the following:

  • Set the BlazorWebAssemblyEnableLinking property to false in the project file to disable the link with an MSBuild property.
    <PropertyGroup>
    ...
      <BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
    </PropertyGroup>
    
  • Add the LinkerConfig.xml file and include the following code:
    <?xml version="1.0" encoding="UTF-8" ?>
    ...
    <linker>
      <assembly fullname="mscorlib">
      ...
        <type fullname="System.Threading.WasmRuntime" />
      </assembly>
      <assembly fullname="System.Core">
      ...
        <type fullname="System.Linq.Expressions*" />
        <type fullname="System.Linq.Queryable*" />
        <type fullname="System.Linq.Enumerable*" />
        <type fullname="System.Linq.EnumerableRewriter*" />
      </assembly>
      ...
      <assembly fullname="[PUT YOUR ASSEMBLY NAME HERE]" />
    </linker>
    
    Then specify this file as an MSBuild item in the project file.
    <ItemGroup>
      ...
      <BlazorLinkerDescriptor Include="LinkerConfig.xml" />
    </ItemGroup>
    

See the following topic for more information: Configure the Linker for ASP.NET Core Blazor.