I've found what is the issue debugging the exception itself. The error as stated on top is from GetRequestUrl() method and this method (after a bit of my modifications) looks like:
Code: Select all
internal static string GetRequestUrl(ActionContext viewContext, string controller, bool relativeUrls, bool passQueryParams)
{
if (viewContext == null || (viewContext).HttpContext == null)
return (string)null;
HttpRequest request = (viewContext).HttpContext.Request;
PathString pathBase = request.PathBase;
// ISSUE: explicit reference operation
string str1 = ((PathString)@pathBase).ToUriComponent();
if (!relativeUrls)
{
string scheme = request.Scheme;
string str2 = "://";
HostString host = request.Host;
// ISSUE: explicit reference operation
string uriComponent = ((HostString)@host).ToUriComponent();
string str3 = str1;
str1 = scheme + str2 + uriComponent + str3;
}
if (!str1.EndsWith("/"))
str1 += "/";
var routeBase = viewContext.RouteData.Routers[1] as RouteBase;
var routeColletion = viewContext.RouteData.Routers[1] as RouteCollection;
using (IEnumerator<TemplateSegment> enumerator1 = (routeBase.ParsedTemplate.Segments).GetEnumerator())
{
while ((enumerator1).MoveNext())
{
using (List<TemplatePart>.Enumerator enumerator2 = enumerator1.Current.Parts.GetEnumerator())
{
while (enumerator2.MoveNext())
{
TemplatePart current = enumerator2.Current;
str1 = !(current.Name == nameof(controller)) || string.IsNullOrEmpty(controller) ? (!(current.Name == "action") ? (!current.IsParameter ? str1 + current.Text : str1 + (viewContext).RouteData.Values[current.Name]) : str1 + "{action}") : str1 + controller;
}
}
if (!str1.EndsWith("/"))
str1 += "/";
}
}
string str4 = str1.Substring(0, str1.Length - 1);
if (passQueryParams)
return str4 + (object)request.QueryString;
return str4;
}
Code: Select all
private ActionContext GetActionContext(IServiceProvider serviceProvider)
{
return new ActionContext(this.HttpContext, RouteData, new ActionDescriptor());
}