Describe what is not working as expected.
When one of the params in a query is NULL a NPE is thrown.
// This generates a NPE
.Where(q => q.CodeTypeId == codeType /*int*/ && q.CodeKey == key/*NULL*/).Cacheable(TimeSpan.FromMinutes(10)).FirstOrDefault()
Exception message: Object reference not set to an instance of an object
Stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at EntityFrameworkCore.Cacheable.MemoryCacheProvider.<>c.b__7_0(KeyValuePair`2 d)
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.String.Join(String separator, IEnumerable`1 values)
at EntityFrameworkCore.Cacheable.MemoryCacheProvider.CreateQueryKey(Expression expression, IReadOnlyDictionary`2 parameterValues)
at EntityFrameworkCore.Cacheable.CustomQueryCompiler.Execute[TResult](Expression query)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at Mx.BusinessLogic.CodeFacade.GetSingleCached(Int32 codeType, String key)
Steps to reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
// To Reproduce use any cached query where one of the params is null. In this case null is a valid value
// The exception happens at MemoryCacheProvider line 60
Further technical details
EntityFrameworkCore.Cacheable version: 2.0.0
EF Core version: 2.2.1
IDE: Visual Studio 2017
Describe what is not working as expected. When one of the params in a query is NULL a NPE is thrown.
Steps to reproduce
Include a complete code listing (or project/solution) that we can run to reproduce the issue.
Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.
Further technical details
EntityFrameworkCore.Cacheable version: 2.0.0 EF Core version: 2.2.1 IDE: Visual Studio 2017