Linq Error with .NET 6.0 Preview 3 and DropDown Control

I'm experiencing an error with the DropDown control and .NET 6.0 Preview 3. When selecting an item in the dropdown, the console error below appears related to System.Linq.Dynamic.Core.

  • I've created a demo project that shows the issue. https://github.com/StevenFischerWI/RadzenDemo/

  • The issue is similar to this previously reported issue., however, the documented fix involving linker configuration does not solve the problem for me.

  • I believe this is related to breaking changes relating to .NET 6 and Linq Queryable overloads (I can't link to it here due to a limitation on a new user posting more than two links :confused:)

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: The type initializer for 'System.Linq.Dynamic.Core.DynamicQueryableExtensions' threw an exception. System.TypeInitializationException: The type initializer for 'System.Linq.Dynamic.Core.DynamicQueryableExtensions' threw an exception. ---> System.Exception: Specific method not found: FirstOrDefault ---> System.InvalidOperationException: Sequence contains more than one matching element

This issue is preventing me from moving to .NET 6 Preview 3. Thank you for your help!

I’m afraid that we cannot do much.

Indeed we can't do much until this issue is addressed.

Ah, so the query provider isn't something that we can change within Radzen, rather we need to wait for zzzprojects/System.Linq.Dynamic.Core to make the change. Got it - thank you.

Gladly (in my case), this now appears addressed with the latest preview:

Looks like I found a good time to join this party. :sweat_smile:

I tried updating to 6.0 preview 7, razden 3.9.2, system.linq.dynamic.core 1.2.12. I can select an item in the drop down control but searching still gives an error (below). Grid control sorting and filtering seems to work though.

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: The type initializer for 'System.Linq.Dynamic.Core.DynamicQueryableExtensions' threw an exception.
System.TypeInitializationException: The type initializer for 'System.Linq.Dynamic.Core.DynamicQueryableExtensions' threw an exception.
 ---> System.Exception: Specific method not found: FirstOrDefault
 ---> System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException() in System.Linq.dll:token 0x6000319+0x0
   at System.Linq.Enumerable.TryGetSingle[MethodInfo](IEnumerable`1 source, Func`2 predicate, Boolean& found) in System.Linq.dll:token 0x60000d3+0x3d
   at System.Linq.Enumerable.Single[MethodInfo](IEnumerable`1 source, Func`2 predicate) in System.Linq.dll:token 0x60000cd+0x0
   at System.Linq.Dynamic.Core.DynamicQueryableExtensions.GetMethod(String name, Int32 parameterCount, Func`2 predicate) in System.Linq.Dynamic.Core.dll:token 0x60000d1+0x14
   --- End of inner exception stack trace ---
   at System.Linq.Dynamic.Core.DynamicQueryableExtensions.GetMethod(String name, Int32 parameterCount, Func`2 predicate) in System.Linq.Dynamic.Core.dll:token 0x60000d1+0x3e
   at System.Linq.Dynamic.Core.DynamicQueryableExtensions..cctor() in System.Linq.Dynamic.Core.dll:token 0x60000d2+0xe3
   --- End of inner exception stack trace ---
   at Radzen.DropDownBase`1[[System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_View() in Radzen.Blazor.dll:token 0x60001f9+0x92
   at Radzen.DropDownBase`1.<HandleKeyPress>d__64[[System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Radzen.Blazor.dll:token 0x60012c5+0x41
   at Radzen.DropDownBase`1.<OnFilterKeyPress>d__65[[System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() in Radzen.Blazor.dll:token 0x60012c7+0x69
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a5+0x7e
   at Radzen.DropDownBase`1[[System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_View() in Radzen.Blazor.dll:token 0x60001f9+0x92
   at Radzen.Blazor.RadzenDropDown`1[[System.Nullable`1[[System.Int64, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].BuildRenderTree(RenderTreeBuilder __builder) in Radzen.Blazor.dll:token 0x600088c+0xb3d
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder) in Microsoft.AspNetCore.Components.dll:token 0x60000a8+0xe
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException) in Microsoft.AspNetCore.Components.dll:token 0x600030a+0x17

Just tried latest Radzen.Blazor and everything seems to work:



Check this thread for reference: