Using Silverback.Integration.HealthChecks 1.0.4 and Microsoft.EntityFrameworkCore 3.0.1, the following exception is thrown executing the OutboundQueueHealthCheck
.
[12:12:42 ERR - c8146ba0-4720943f5eccaf33] Health check OutboundQueue threw an unhandled exception after 189.6989ms <s:Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService>
System.InvalidOperationException: Processing of the LINQ expression 'DefaultIfEmpty<DateTime>(
source: Select<OutboundMessage, DateTime>(
source: Where<OutboundMessage>(
source: DbSet<OutboundMessage>,
predicate: (m) => m.Produced == null),
selector: (m) => m.Created),
defaultValue: (Unhandled parameter: __p_0))' by 'NavigationExpandingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core. See https://go.microsoft.com/fwlink/?
linkid=2101433 for more detailed information.
at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.ExpandAndReduce(Expression query, Boolean applyInclude)
at Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor.Expand(Expression query)
at Microsoft.EntityFrameworkCore.Query.QueryTranslationPreprocessor.Process(Expression query)
at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass12_0`1.<ExecuteAsync>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, Expression expression, CancellationToken c
ancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ExecuteAsync[TSource,TResult](MethodInfo operatorMethodInfo, IQueryable`1 source, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.MinAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Silverback.Database.EfCoreQueryableExtensions.MinAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Silverback.Database.SilverbackQueryableExtensions.MinAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Silverback.Messaging.Connectors.Repositories.DbOutboundQueueConsumer.GetMaxAge()
at Silverback.Messaging.HealthChecks.OutboundQueueHealthCheckService.CheckIsHealthy(Nullable`1 maxAge, Nullable`1 maxQueueLength)
at Silverback.Messaging.HealthChecks.OutboundQueueHealthCheck.CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken)
at Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService.RunCheckAsync(IServiceScope scope, HealthCheckRegistration registration, CancellationToken cancellationToken)