I need to access the UrlHelper through IUrlHelperFactory and IUrlHelperFactory needs ActionContext. I register both, but it results in IIS quitting with "Access Violation" message.
IServiceCollection:
.AddSingleton<IActionContextAccessor, ActionContextAccessor>()
.AddSingleton<IUrlHelperFactory, UrlHelperFactory>();
Tag Helper:
private readonly IUrlHelper _url;
public ServiceIconTagHelper(IUrlHelperFactory url, IActionContextAccessor context)
{
_url = url.GetUrlHelper(context.ActionContext);
}
Output exception: The program '[1624] iisexpress.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
User contributions licensed under CC BY-SA 3.0