修复监控bug

This commit is contained in:
2026-09-16 09:01:27 +08:00
parent 432ed2a70c
commit 96680fd4c6
3 changed files with 37 additions and 13 deletions
+3 -1
View File
@@ -233,7 +233,9 @@ namespace MonitorModule.ViewModels
.Where(m =>
{
if (m.GetCustomAttribute<MonitorableAttribute>() == null) return false;
if (m.ReturnType != typeof(Task<string>)) return false;
// 同时支持 Task<string> 和 Task<double> 返回类型
var rt = m.ReturnType;
if (rt != typeof(Task<string>) && rt != typeof(Task<double>)) return false;
var parms = m.GetParameters();
return parms.Length == 0 ||
(parms.Length == 1 && parms[0].ParameterType == typeof(CancellationToken));