Browse Source

Remove unnecessary C# async/await (#3922)

Joni 7 years ago
parent
commit
0b41944925

+ 2 - 2
frameworks/CSharp/aspnetcore/Benchmarks/Middleware/MiddlewareHelpers.cs

@@ -30,7 +30,7 @@ namespace Benchmarks.Middleware
                     : 1;
                     : 1;
         }
         }
 
 
-        public static async Task RenderFortunesHtml(IEnumerable<Fortune> model, HttpContext httpContext, HtmlEncoder htmlEncoder)
+        public static Task RenderFortunesHtml(IEnumerable<Fortune> model, HttpContext httpContext, HtmlEncoder htmlEncoder)
         {
         {
             httpContext.Response.StatusCode = StatusCodes.Status200OK;
             httpContext.Response.StatusCode = StatusCodes.Status200OK;
             httpContext.Response.ContentType = "text/html; charset=UTF-8";
             httpContext.Response.ContentType = "text/html; charset=UTF-8";
@@ -50,7 +50,7 @@ namespace Benchmarks.Middleware
             var response = StringBuilderCache.GetStringAndRelease(sb);
             var response = StringBuilderCache.GetStringAndRelease(sb);
             // fortunes includes multibyte characters so response.Length is incorrect
             // fortunes includes multibyte characters so response.Length is incorrect
             httpContext.Response.ContentLength = Encoding.UTF8.GetByteCount(response);
             httpContext.Response.ContentLength = Encoding.UTF8.GetByteCount(response);
-            await httpContext.Response.WriteAsync(response);
+            return httpContext.Response.WriteAsync(response);
         }
         }
     }
     }
 }
 }