jasee
07/13/2023, 12:28 AMpublic class AjaxController : SurfaceController {
private IShippingMethodSelector _shippingMethodSelector;
public AjaxController(
IUmbracoContextAccessor umbracoContextAccessor,
IUmbracoDatabaseFactory databaseFactory,
ServiceContext services,
AppCaches appCaches,
IProfilingLogger profilingLogger,
IPublishedUrlProvider publishedUrlProvider,
IShippingMethodSelector shppingMethodSelector)
: base(umbracoContextAccessor, databaseFactory, services, appCaches, profilingLogger, publishedUrlProvider) {
_shippingMethodSelector = shppingMethodSelector;
}
if (matches.Count > 0) {
This returns null, and doesn't hit method breakpoint ---->>
methods = _shippingMethodSelector?.GetFedExInternationalShippingMethods(new AddressModel() { Country = countryCode, PostalCode = postalCode }, zone));
}
}
...
D_Inventor
07/13/2023, 3:58 AMMaarten
07/13/2023, 7:06 AMSebastiaan
07/13/2023, 7:20 AMSurfaceController
the method name makes me suspect this should be an Web API controller - https://docs.umbraco.com/umbraco-cms/reference/routing/umbraco-api-controllers
But yes, looks like _shippingMethodSelector
is null probably because it's not registered, you should have something like this somewhere:
csharp
public class RegisterServices : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Services.AddSingleton<IShippingMethodSelector, ShippingMethodSelector>();
}
}
jasee
07/13/2023, 2:54 PMD_Inventor
07/13/2023, 3:05 PMIShippingMethodSelector
service live in relation to your umbraco application? Is it in the main application or do you reference it from a dll or do you have a separate class library and a project reference?
It could be that you have some old dll somewhere stuck in your bin folder. It's also worth trying to remove your bin and obj folders on all your projects inside your solution and then rebuild. If you have some old dll stuck somewhere, it can cause some very nasty unexpected behaviourjasee
07/13/2023, 4:04 PM