You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the UsePostgreSqlOutbox ServiceCollection Extension a System.InvalidCastException is thrown because the PostgreSqlOutboxSync class is being registered as the implementation for IAmAnOutboxAsync as well as IAmAnOutboxSync.
The method name BuildDynamoDbOutbox is also a bit misleading.
To Reproduce
Implement the UsePostgreSqlOutbox extension (Brighter/src/Paramore.Brighter.Outbox.PostgreSql/ServiceCollectionExtensions.cs).
Exception
System.InvalidCastException: Unable to cast object of type 'Paramore.Brighter.Outbox.PostgreSql.PostgreSqlOutboxSync' to type 'Paramore.Brighter.IAmAnOutboxAsync1[Paramore.Brighter.Message]'. at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Paramore.Brighter.Extensions.DependencyInjection.ServiceCollectionExtensions.BuildCommandProcessor(IServiceProvider provider, IAmAHandlerFactory handlerFactory) at Paramore.Brighter.Extensions.DependencyInjection.ServiceCollectionExtensions.<>c__DisplayClass1_0.<BrighterHandlerBuilder>b__0(IServiceProvider sp) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method8(Closure , IServiceProvider , Object[] )
Description
When using the UsePostgreSqlOutbox ServiceCollection Extension a System.InvalidCastException is thrown because the PostgreSqlOutboxSync class is being registered as the implementation for IAmAnOutboxAsync as well as IAmAnOutboxSync.
The method name BuildDynamoDbOutbox is also a bit misleading.
To Reproduce
Implement the UsePostgreSqlOutbox extension (Brighter/src/Paramore.Brighter.Outbox.PostgreSql/ServiceCollectionExtensions.cs).
Exception
System.InvalidCastException: Unable to cast object of type 'Paramore.Brighter.Outbox.PostgreSql.PostgreSqlOutboxSync' to type 'Paramore.Brighter.IAmAnOutboxAsync
1[Paramore.Brighter.Message]'. at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Paramore.Brighter.Extensions.DependencyInjection.ServiceCollectionExtensions.BuildCommandProcessor(IServiceProvider provider, IAmAHandlerFactory handlerFactory) at Paramore.Brighter.Extensions.DependencyInjection.ServiceCollectionExtensions.<>c__DisplayClass1_0.<BrighterHandlerBuilder>b__0(IServiceProvider sp) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSite(ServiceCallSite callSite, TArgument argument)at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method8(Closure , IServiceProvider , Object[] )
Further technical details
The text was updated successfully, but these errors were encountered: