We have a background task that depends on _pictureService.GetPictureUrl method. In the method GetImagesPathUrl (which is called by GetThumbUrl) the _httpContextAccessor.HttpContext is NULL and throws an error. In 4.10 this method didn't exist and the shop path was handled by webHelper.GetStoreLocation(); I guess the Task doesn't have a context, hence the exception.
In 4.20 you can find here,
I have same problem in version 4.20.
How to create new instance of IHttpContextAccessor in my plugin's static method.
I use this code in my static method,but httpAccessor.HttpContext is null.
var httpAccessor = EngineContext.Current.Resolve<IHttpContextAccessor>();
var domainName = httpAccessor.HttpContext.Request.Host.ToString();
Please advice me.
If you want to use in static class than httpconext pass as method para.
May be it works, try please.