Skip to content

Commit 2e68974

Browse files
authored
Use TaskCache class from Microsoft.Extensions.TaskCache.Sources (#28)
Instead of Task.FromResult(0)
1 parent 0d79b52 commit 2e68974

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/Microsoft.VisualStudio.Web.BrowserLink/HttpSocketAdapter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Text;
77
using System.Threading;
88
using System.Threading.Tasks;
9+
using Microsoft.Extensions.Internal;
910

1011
namespace Microsoft.VisualStudio.Web.BrowserLink
1112
{
@@ -388,14 +389,14 @@ private Task ReadContent()
388389

389390
if (String.IsNullOrEmpty(contentLengthString))
390391
{
391-
return StaticTaskResult.Zero;
392+
return TaskCache.CompletedTask;
392393
}
393394

394395
long contentLength;
395396

396397
if (!Int64.TryParse(contentLengthString, out contentLength))
397398
{
398-
return StaticTaskResult.Zero;
399+
return TaskCache.CompletedTask;
399400
}
400401

401402
return ReadBytesIntoResponse(contentLength);

src/Microsoft.VisualStudio.Web.BrowserLink/Project.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
"dependencies": {
1515
"Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0",
1616
"Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
17-
"Microsoft.Extensions.FileProviders.Physical": "1.0.0"
17+
"Microsoft.Extensions.FileProviders.Physical": "1.0.0",
18+
"Microsoft.Extensions.TaskCache.Sources": {
19+
"version": "1.1.0-*",
20+
"type": "build"
21+
}
1822
},
1923
"frameworks": {
2024
"net451": {},

src/Microsoft.VisualStudio.Web.BrowserLink/StaticTaskResult.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ internal static class StaticTaskResult
1313
public static readonly Task Complete = True;
1414

1515
public static readonly Task<int> HttpInternalServerError = Task.FromResult(500);
16-
17-
public static readonly Task<int> Zero = Task.FromResult(0);
1816
}
1917
}

0 commit comments

Comments
 (0)