From 56b3fb9b6f49ca0864e962d8fcf76fb235dcb2b8 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Mon, 29 Aug 2016 14:52:34 -0700 Subject: [PATCH] [Fixes #351] Error message incorrectly references RouteCollection when you don't set the default handler on RouteBuilder --- .../MapRouteRouteBuilderExtensions.cs | 2 +- .../Properties/Resources.Designer.cs | 8 ++++---- src/Microsoft.AspNetCore.Routing/Resources.resx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNetCore.Routing/MapRouteRouteBuilderExtensions.cs b/src/Microsoft.AspNetCore.Routing/MapRouteRouteBuilderExtensions.cs index d3cc115e6d..ef55007af3 100644 --- a/src/Microsoft.AspNetCore.Routing/MapRouteRouteBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Routing/MapRouteRouteBuilderExtensions.cs @@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Builder { if (routeBuilder.DefaultHandler == null) { - throw new RouteCreationException(Resources.DefaultHandler_MustBeSet); + throw new RouteCreationException(Resources.FormatDefaultHandler_MustBeSet(nameof(IRouteBuilder))); } var inlineConstraintResolver = routeBuilder diff --git a/src/Microsoft.AspNetCore.Routing/Properties/Resources.Designer.cs b/src/Microsoft.AspNetCore.Routing/Properties/Resources.Designer.cs index 9dd91e7f85..efc7928b7c 100644 --- a/src/Microsoft.AspNetCore.Routing/Properties/Resources.Designer.cs +++ b/src/Microsoft.AspNetCore.Routing/Properties/Resources.Designer.cs @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Routing } /// - /// A default handler must be set on the RouteCollection. + /// A default handler must be set on the {0}. /// internal static string DefaultHandler_MustBeSet { @@ -83,11 +83,11 @@ namespace Microsoft.AspNetCore.Routing } /// - /// A default handler must be set on the RouteCollection. + /// A default handler must be set on the {0}. /// - internal static string FormatDefaultHandler_MustBeSet() + internal static string FormatDefaultHandler_MustBeSet(object p0) { - return GetString("DefaultHandler_MustBeSet"); + return string.Format(CultureInfo.CurrentCulture, GetString("DefaultHandler_MustBeSet"), p0); } /// diff --git a/src/Microsoft.AspNetCore.Routing/Resources.resx b/src/Microsoft.AspNetCore.Routing/Resources.resx index 6af7dff663..6c3fcc582b 100644 --- a/src/Microsoft.AspNetCore.Routing/Resources.resx +++ b/src/Microsoft.AspNetCore.Routing/Resources.resx @@ -130,7 +130,7 @@ The supplied route name '{0}' is ambiguous and matched more than one route. - A default handler must be set on the RouteCollection. + A default handler must be set on the {0}. The constructor to use for activating the constraint type '{0}' is ambiguous. Multiple constructors were found with the following number of parameters: {1}.