Skip to content

Null Reference Exception #27

Description

@lalibi

I get a Null Reference Exception, possibly due to the BrowserLink feature in the new Visual Studio (it seems route.DataTokens is null in a route generated by BrowserLink).

I downloaded the code and added a quick fix. I should probably do a pull request, but I am not entirely sure this is the proper way to solve it:

// If there's no controller specified, we need to check if it's in an area
if (!route.Defaults.ContainsKey("controller"))
{
    // Added this line here:
    if (route.DataTokens == null)
        return false;

    // Not an area, so it's a "regular" default route
    if (!route.DataTokens.ContainsKey("area"))
        return true;

    // Exposing all routes, or an area that's explicitly whitelisted
    if (_configuration.ExposeAllRoutes || _areaWhitelist.Contains(route.DataTokens["area"]))
        return true;

    // In an area that's not exposed, so this route shouldn't be exposed.
    return false;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions