umbraco / Umbraco.Commerce.Issues

17 stars 2 forks source link

Clicking dictionary icon returns an exception #392

Closed konius closed 2 years ago

konius commented 2 years ago

Using Vendr 3.0.2 and Umbraco 10.3.0-rc.

Clicking the dictionary icon next to text input shows an error.

image

image

An error occurred
Cannot resolve scoped service 'Microsoft.Extensions.Options.IOptionsSnapshot`1[Umbraco.Cms.Core.Configuration.Models.GlobalSettings]' from root provider.

Exception Details
System.InvalidOperationException, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Cannot resolve scoped service 'Microsoft.Extensions.Options.IOptionsSnapshot`1[Umbraco.Cms.Core.Configuration.Models.GlobalSettings]' from root provider.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(Type serviceType, IServiceScope scope, IServiceScope rootScope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Vendr.Infrastructure.ServiceProviderFactoryBase.GetInstance[T]()
   at Vendr.Common.ServiceLocator.Locate[T]()
   at Vendr.Umbraco.Web.Controllers.VendrDictionaryController..ctor(IBackOfficeSecurityAccessor backOfficeSecurityAccesor, VendrContext vendrContext)
   at lambda_method1676(Closure , IServiceProvider , Object[] )
   at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass6_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
mattbrailsford commented 2 years ago

Good spot @konius

I've implemented a fix and there should be a 3.0.3-beta0001 on our unstable NuGet feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json shortly if you want to test this yourself.

I only released 3.0.2 today so I will have to wait a few days before I push this fix out, but you can safely use that beta in the meantime

mattbrailsford commented 2 years ago

Fixed in 3.0.3 released today