diff --git a/Plugins/MySqlAgent/MySqlAgent.csproj b/Plugins/MySqlAgent/MySqlAgent.csproj
index 0a914ff2..d0168b70 100644
--- a/Plugins/MySqlAgent/MySqlAgent.csproj
+++ b/Plugins/MySqlAgent/MySqlAgent.csproj
@@ -20,7 +20,7 @@
-
+
diff --git a/Samples/TestA/TestA.csproj b/Samples/TestA/TestA.csproj
index 454b6e67..2b6952b8 100644
--- a/Samples/TestA/TestA.csproj
+++ b/Samples/TestA/TestA.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/Samples/TestB/TestB.csproj b/Samples/TestB/TestB.csproj
index cf022f71..a34652e7 100644
--- a/Samples/TestB/TestB.csproj
+++ b/Samples/TestB/TestB.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/Stardust.Data/Stardust.Data.csproj b/Stardust.Data/Stardust.Data.csproj
index 88637383..65b2f733 100644
--- a/Stardust.Data/Stardust.Data.csproj
+++ b/Stardust.Data/Stardust.Data.csproj
@@ -41,7 +41,7 @@
-
+
diff --git a/Stardust.Extensions/Caches/CacheFileProvider.cs b/Stardust.Extensions/Caches/CacheFileProvider.cs
index d02b2d4e..2f1a3e2a 100644
--- a/Stardust.Extensions/Caches/CacheFileProvider.cs
+++ b/Stardust.Extensions/Caches/CacheFileProvider.cs
@@ -107,7 +107,7 @@ public IFileInfo GetFileInfo(String subpath)
if (Path.GetFileName(fullPath).Contains('.'))
{
if (!fi.Exists)
- fi = DownloadFile(subpath, fullPath).Result?.AsFile();
+ fi = DownloadFile(subpath, fullPath).ConfigureAwait(false).GetAwaiter().GetResult()?.AsFile();
else if (fi.LastWriteTime.AddMonths(1) < DateTime.Now)
_ = Task.Run(() => DownloadFile(subpath, fullPath));
}
@@ -138,7 +138,7 @@ public IFileInfo GetFileInfo(String subpath)
{
using var fs = new FileStream(tmp, FileMode.OpenOrCreate);
using var client = new HttpClient { Timeout = Timeout };
- using var rs = await client.GetStreamAsync(url);
+ using var rs = await client.GetStreamAsync(url).ConfigureAwait(false);
rs.CopyTo(fs);
fs.Flush();
fs.SetLength(fs.Position);
@@ -248,7 +248,7 @@ public IDirectoryContents GetDirectoryContents(String subpath)
XTrace.WriteLine("下载目录:{0}", url);
using var client = new HttpClient { Timeout = Timeout };
- var html = await client.GetStringAsync(url);
+ var html = await client.GetStringAsync(url).ConfigureAwait(false);
var links = Link.Parse(html, url);
var list = links.Select(e => new FileInfoModel
diff --git a/Stardust.Extensions/IpFilterMiddleware.cs b/Stardust.Extensions/IpFilterMiddleware.cs
index 90d8a137..978a2ce2 100644
--- a/Stardust.Extensions/IpFilterMiddleware.cs
+++ b/Stardust.Extensions/IpFilterMiddleware.cs
@@ -46,7 +46,7 @@ public async Task Invoke(HttpContext ctx)
}
}
- await _next.Invoke(ctx);
+ await _next.Invoke(ctx).ConfigureAwait(false);
}
Boolean ValidIP(String ip)
diff --git a/Stardust.Extensions/Stardust.Extensions.csproj b/Stardust.Extensions/Stardust.Extensions.csproj
index e81200f8..24e690f0 100644
--- a/Stardust.Extensions/Stardust.Extensions.csproj
+++ b/Stardust.Extensions/Stardust.Extensions.csproj
@@ -20,6 +20,8 @@
True
..\Doc\newlife.snk
1701;1702;NU5104;NETSDK1138;CS7035
+ latest
+ CA2007
diff --git a/Stardust.Extensions/TracerMiddleware.cs b/Stardust.Extensions/TracerMiddleware.cs
index cd4313d9..eb961509 100644
--- a/Stardust.Extensions/TracerMiddleware.cs
+++ b/Stardust.Extensions/TracerMiddleware.cs
@@ -58,7 +58,7 @@ public async Task Invoke(HttpContext ctx)
{
req.EnableBuffering();
- var count = await req.Body.ReadAsync(buf, 0, buf.Length);
+ var count = await req.Body.ReadAsync(buf, 0, buf.Length).ConfigureAwait(false);
span.AppendTag("\r\n<=\r\n" + buf.ToStr(null, 0, count));
req.Body.Position = 0;
flag = true;
@@ -91,7 +91,7 @@ public async Task Invoke(HttpContext ctx)
try
{
- await _next.Invoke(ctx);
+ await _next.Invoke(ctx).ConfigureAwait(false);
// 自动记录用户访问主机地址
SaveServiceAddress(ctx);
@@ -119,7 +119,7 @@ public async Task Invoke(HttpContext ctx)
try
{
var p = res.Body.Position;
- var count = await res.Body.ReadAsync(buf, 0, buf.Length);
+ var count = await res.Body.ReadAsync(buf, 0, buf.Length).ConfigureAwait(false);
span.AppendTag("\r\n=>\r\n" + buf.ToStr(null, 0, count));
res.Body.Position = p;
flag = true;
diff --git a/Stardust.Server/Stardust.Server.csproj b/Stardust.Server/Stardust.Server.csproj
index 300d6732..0db73667 100644
--- a/Stardust.Server/Stardust.Server.csproj
+++ b/Stardust.Server/Stardust.Server.csproj
@@ -46,7 +46,7 @@
-
+
diff --git a/Stardust.Web/Stardust.Web.csproj b/Stardust.Web/Stardust.Web.csproj
index 218a6114..8d00271c 100644
--- a/Stardust.Web/Stardust.Web.csproj
+++ b/Stardust.Web/Stardust.Web.csproj
@@ -53,7 +53,7 @@
-
+
diff --git a/Stardust/AppClient.cs b/Stardust/AppClient.cs
index fdc3af21..65913402 100644
--- a/Stardust/AppClient.cs
+++ b/Stardust/AppClient.cs
@@ -174,7 +174,7 @@ public override IPingRequest BuildPingRequest()
if (_appInfo == null) return null;
- return await local.PingAsync(_appInfo, WatchdogTimeout);
+ return await local.PingAsync(_appInfo, WatchdogTimeout).ConfigureAwait(false);
}
/// 心跳
@@ -187,13 +187,13 @@ protected override async Task OnPing(Object state)
try
{
// 向服务端发送心跳后,再向本地发送心跳
- await base.OnPing(state);
- await PingLocal();
+ await base.OnPing(state).ConfigureAwait(false);
+ await PingLocal().ConfigureAwait(false);
if (!NetworkInterface.GetIsNetworkAvailable()) return;
- await RefreshPublish();
- await RefreshConsume();
+ await RefreshPublish().ConfigureAwait(false);
+ await RefreshConsume().ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -214,17 +214,17 @@ protected override async Task OnPing(Object state)
// 如果没有设置地址,则不要调用接口
if (service.Address.IsNullOrEmpty()) return null;
- return await InvokeAsync("App/RegisterService", service);
+ return await InvokeAsync("App/RegisterService", service).ConfigureAwait(false);
}
/// 取消服务(底层)
/// 应用服务
///
- public async Task UnregisterAsync(PublishServiceInfo service)
+ public Task UnregisterAsync(PublishServiceInfo service)
{
_publishServices.TryRemove(service.ServiceName, out _);
- return await InvokeAsync("App/UnregisterService", service);
+ return InvokeAsync("App/UnregisterService", service);
}
private void AddService(PublishServiceInfo service)
@@ -284,7 +284,7 @@ public async Task RegisterAsync(String serviceName, String a
service.Tag = tag;
service.Health = health;
- var rs = await RegisterAsync(service);
+ var rs = await RegisterAsync(service).ConfigureAwait(false);
WriteLog("注册完成 {0}", rs?.ToJson());
return service;
@@ -328,7 +328,7 @@ public PublishServiceInfo Register(String serviceName, Func addressCall
/// 消费服务(底层)
/// 应用服务
///
- public async Task ResolveAsync(ConsumeServiceInfo service) => await InvokeAsync("App/ResolveService", service);
+ public Task ResolveAsync(ConsumeServiceInfo service) => InvokeAsync("App/ResolveService", service);
/// 消费得到服务地址信息
/// 服务名
@@ -356,7 +356,7 @@ public PublishServiceInfo Register(String serviceName, Func addressCall
// 消费即使报错,也要往下走,借助缓存
try
{
- var models = await ResolveAsync(service);
+ var models = await ResolveAsync(service).ConfigureAwait(false);
if (models != null && models.Length > 0)
{
_consumes[serviceName] = models;
@@ -405,7 +405,7 @@ private async Task RefreshPublish()
if (!address.IsNullOrEmpty()) svc.Address = address;
}
- if (!svc.Address.IsNullOrEmpty()) await RegisterAsync(svc);
+ if (!svc.Address.IsNullOrEmpty()) await RegisterAsync(svc).ConfigureAwait(false);
}
}
@@ -415,7 +415,7 @@ private async Task RefreshConsume()
foreach (var item in _consumeServices)
{
var svc = item.Value;
- var ms = await ResolveAsync(svc);
+ var ms = await ResolveAsync(svc).ConfigureAwait(false);
if (ms != null && ms.Length > 0)
{
_consumes[svc.ServiceName] = ms;
@@ -473,7 +473,7 @@ public void Attach(ICommandClient client)
private async Task DoRefresh(String? argument)
{
- await RefreshConsume();
+ await RefreshConsume().ConfigureAwait(false);
return "刷新服务成功";
}
diff --git a/Stardust/DingTalk/DingTalkClient.cs b/Stardust/DingTalk/DingTalkClient.cs
index 15b8a588..cf643a21 100644
--- a/Stardust/DingTalk/DingTalkClient.cs
+++ b/Stardust/DingTalk/DingTalkClient.cs
@@ -19,11 +19,11 @@ public class DingTalkClient
#endregion
#region 发送消息
- private async Task
@@ -117,10 +119,10 @@
-
+
-
+
diff --git a/Stardust/WeiXin/WeiXinClient.cs b/Stardust/WeiXin/WeiXinClient.cs
index de7c870e..962d38c9 100644
--- a/Stardust/WeiXin/WeiXinClient.cs
+++ b/Stardust/WeiXin/WeiXinClient.cs
@@ -18,11 +18,11 @@ public class WeiXinClient
#endregion
#region 发送消息
- private async Task PostAsync(Object msg)
+ private Task PostAsync(Object msg)
{
_Client ??= Tracer.CreateHttpClient();
- return await _Client.PostAsync(Url, msg);
+ return _Client.PostAsync(Url, msg);
}
/// 发送文本消息
diff --git a/Test/Test.csproj b/Test/Test.csproj
index f2b3d9a9..5b72bace 100644
--- a/Test/Test.csproj
+++ b/Test/Test.csproj
@@ -30,7 +30,7 @@
-
+