morrisjdev/FileContextCore

No support for .Net 6

gjhommersom opened this issue · 0 comments

I'm using this library for some test projects. This works fine as long as the target framework is .Net 5 or lower. Setting it to .Net 6 will break some queries.

  Message: 
System.TypeInitializationException : The type initializer for 'Microsoft.EntityFrameworkCore.EnumerableMethods' threw an exception.
  ----> System.InvalidOperationException : Sequence contains more than one matching element

  Stack Trace: 
EnumerableMethods.get_AnyWithPredicate()
AllAnyToContainsRewritingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
QueryTranslationPreprocessor.Process(Expression query)
QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
Database.CompileQuery[TResult](Expression query, Boolean async)
QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
<>c__DisplayClass9_0`1.<Execute>b__0()
CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
<17 more frames...>
ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
ContextUtils.DoIsolated(ContextCallback callback, Object state)
ContextUtils.DoIsolated[T](Func`1 func)
SimpleWorkItem.PerformWork()
--InvalidOperationException
ThrowHelper.ThrowMoreThanOneMatchException()
Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
EnumerableMethods.cctor()

I managed to get it to work by updating this library to use .Net 6 as well.

An update to EFCore6 does not seem required.