public static Task<string> getMapName() { if (MapView.Active == null) return ""; return QueuedTask.Run(() => { return MapView.Active.Map.GetDefinition().Name; }); } 修改为 public static Task<string> getMapName() { if (MapView.Active == null) return Task.FromResult(""); return QueuedTask.Run(() => { return MapView.Active.Map.GetDefinition().Name; }); }
总结:return ""修改为return Task.FromResult("");