EntityFramework-Plus icon indicating copy to clipboard operation
EntityFramework-Plus copied to clipboard

EF6 Global Query Filter Broken In .NET 6

Open cmeyertons opened this issue 2 years ago • 3 comments

1. Description

Global Query Filters throw a null reference exception when attempting to add in .NET 6 -- this is due to an internal change on ConditionalWeakTable -- it no longer has a Values property and instead implements IEnumerable<KeyValuePair<TKey, TValue>>

2. Exception

Null Reference Exception when adding a global query filter in .NET 6

https://github.com/zzzprojects/EntityFramework-Plus/blob/32f83427c723ba75cf615cc708df21bcab5802d5/src/shared/Z.EF.Plus.QueryFilterInterceptor.Shared/QueryFilterInterceptorManager.cs

The ClearAllCache method needs to detect if the CacheWeakFilterContext is an IEnumerable before trying to dynamically access the property.

cmeyertons avatar Mar 29 '22 19:03 cmeyertons

Hello @cmeyertons ,

Thank for letting us know. We will look at it and how to fix it since this probably impacts more than one of our project.

Best Regards,

Jon

JonathanMagnan avatar Mar 30 '22 01:03 JonathanMagnan

Hello @cmeyertons ,

The v6.13.17 has been released.

We do not longer use reflection starting from this version but instead use the ToList which is now available.

Let me know if everything is now working correctly.


Is this library useful to you? Please help us by becoming a sponsor to keep it alive and supported.

JonathanMagnan avatar Apr 13 '22 14:04 JonathanMagnan

Awesome news, thank you for the quick fix / turnaround!

cmeyertons avatar Apr 13 '22 17:04 cmeyertons