Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.InvalidCastException thrown when using UsePostgreSqlOutbox ServiceCollection Extension #1820

Closed
samrumley88 opened this issue Nov 9, 2021 · 0 comments

Comments

@samrumley88
Copy link
Contributor

samrumley88 commented Nov 9, 2021

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.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[] )

Further technical details

  • Brighter version(s): 9.0.1.-preview.2 & 9.0.1.-preview.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant