Skip to content

Add RouteValuesAddress .ToString () #39708

Closed
@yecril71pl

Description

@yecril71pl

Background and Motivation

The following message is unsatisfactory:

Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: No endpoints found for address Microsoft.AspNetCore.Routing.RouteValuesAddress

Proposed API

namespace Microsoft.AspNetCore.Routing
{
    public class RouteValuesAddress
    {
+       public override string ToString();
    }
}

Usage Examples

        if (endpoints.Count == 0)
        {
            Log.EndpointsNotFound(_logger, address);
        }
        else
        {
            Log.EndpointsFound(_logger, address, endpoints);
        }

Alternative Designs

Given the address is generic, It seems easier to define RouteValuesAddress .ToString () than to modify Log.EndpointsNotFound(_logger, address) to display something useful.

Risks

Defining this API is a breaking change. I do not think it will break anything because the current implementation is useless.

diff --git a/.github/ISSUE_TEMPLATE/25_api_proposal.md b/.github/ISSUE_TEMPLATE/25_api_proposal.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedAPI was approved in API review, it can be implementedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-routinghelp wantedUp for grabs. We would accept a PR to help resolve this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions