Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit 2352bd7

Browse files
committed
Change GetService calls to GetRequiredService
GetRequiredService throws for missing services like GetService used to.
1 parent dcb710c commit 2352bd7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Microsoft.AspNet.Http.Extensions/UseMiddlewareExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static IApplicationBuilder UseMiddleware(this IApplicationBuilder builder
1919
{
2020
return builder.Use(next =>
2121
{
22-
var typeActivator = builder.ApplicationServices.GetService<ITypeActivator>();
22+
var typeActivator = builder.ApplicationServices.GetRequiredService<ITypeActivator>();
2323
var instance = typeActivator.CreateInstance(builder.ApplicationServices, middleware, new[] { next }.Concat(args).ToArray());
2424
var methodinfo = middleware.GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public);
2525
return (RequestDelegate)methodinfo.CreateDelegate(typeof(RequestDelegate), instance);

0 commit comments

Comments
 (0)