Add the middleware name to the exception message UseMiddlewareNoInvokeMethod (#993)

Addresses #927
Addresses aspnet/Home#2692
This commit is contained in:
Hossam Barakat 2018-02-02 01:22:08 +11:00 committed by David Fowler
parent fd385a3c54
commit 9119433ab7
4 changed files with 7 additions and 7 deletions

View File

@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Builder
if (invokeMethods.Length == 0)
{
throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNoInvokeMethod(InvokeMethodName, InvokeAsyncMethodName));
throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNoInvokeMethod(InvokeMethodName, InvokeAsyncMethodName, middleware));
}
var methodinfo = invokeMethods[0];

View File

@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Http.Abstractions
=> string.Format(CultureInfo.CurrentCulture, GetString("Exception_UseMiddlewareIServiceProviderNotAvailable"), p0);
/// <summary>
/// No public '{0}' or '{1}' method found.
/// No public '{0}' or '{1}' method found for middleware of type '{2}'.
/// </summary>
internal static string Exception_UseMiddlewareNoInvokeMethod
{
@ -33,10 +33,10 @@ namespace Microsoft.AspNetCore.Http.Abstractions
}
/// <summary>
/// No public '{0}' or '{1}' method found.
/// No public '{0}' or '{1}' method found for middleware of type '{2}'.
/// </summary>
internal static string FormatException_UseMiddlewareNoInvokeMethod(object p0, object p1)
=> string.Format(CultureInfo.CurrentCulture, GetString("Exception_UseMiddlewareNoInvokeMethod"), p0, p1);
internal static string FormatException_UseMiddlewareNoInvokeMethod(object p0, object p1, object p2)
=> string.Format(CultureInfo.CurrentCulture, GetString("Exception_UseMiddlewareNoInvokeMethod"), p0, p1, p2);
/// <summary>
/// '{0}' or '{1}' does not return an object of type '{2}'.

View File

@ -121,7 +121,7 @@
<value>'{0}' is not available.</value>
</data>
<data name="Exception_UseMiddlewareNoInvokeMethod" xml:space="preserve">
<value>No public '{0}' or '{1}' method found.</value>
<value>No public '{0}' or '{1}' method found for middleware of type '{2}'.</value>
</data>
<data name="Exception_UseMiddlewareNonTaskReturnType" xml:space="preserve">
<value>'{0}' or '{1}' does not return an object of type '{2}'.</value>

View File

@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Http
Assert.Equal(
Resources.FormatException_UseMiddlewareNoInvokeMethod(
UseMiddlewareExtensions.InvokeMethodName,
UseMiddlewareExtensions.InvokeAsyncMethodName),
UseMiddlewareExtensions.InvokeAsyncMethodName, typeof(MiddlewareNoInvokeStub)),
exception.Message);
}