diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2020-01-15 15:07:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-15 15:07:04 +0300 |
commit | b97a6f096b4e191832c7eaeb820b6933f1b8910e (patch) | |
tree | ec2f80065fc6f391f9c041747c321c11f398b290 | |
parent | 9a3c6463298b9e26a77b646ecae33f415bec19a2 (diff) | |
parent | 51d26083010e9b8d7005834a46748cc932cd69ca (diff) |
Merge pull request #9492 from mono/task-completed
Switch to Task.CompletedTask where applicable
32 files changed, 47 insertions, 47 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindBaseSymbolsHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindBaseSymbolsHandler.cs index 2b34ab179c..54e6a6d731 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindBaseSymbolsHandler.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindBaseSymbolsHandler.cs @@ -46,7 +46,7 @@ namespace MonoDevelop.CSharp.Navigation Task FindSymbols (ISymbol sym, CancellationTokenSource cancellationTokenSource) { if (sym == null) - return Task.FromResult (0); + return Task.CompletedTask; return Task.Run (delegate { var searchMonitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true); using (var monitor = searchMonitor.WithCancellationSource (cancellationTokenSource)) { diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindDerivedSymbolsHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindDerivedSymbolsHandler.cs index 1817574614..331cb5f694 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindDerivedSymbolsHandler.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindDerivedSymbolsHandler.cs @@ -64,7 +64,7 @@ namespace MonoDevelop.CSharp.Refactoring static Task FindDerivedSymbols (ISymbol symbol, CancellationTokenSource cancellationTokenSource) { if (symbol == null) - return Task.FromResult (0); + return Task.CompletedTask; var solution = IdeApp.Workbench.ActiveDocument?.DocumentContext.AnalysisDocument?.Project?.Solution ?? IdeApp.TypeSystemService.Workspace.CurrentSolution; return Task.Run (async delegate { var searchMonitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true); diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindImplementingMembersHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindImplementingMembersHandler.cs index 5c337577ab..d93f884120 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindImplementingMembersHandler.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Navigation/FindImplementingMembersHandler.cs @@ -83,7 +83,7 @@ namespace MonoDevelop.CSharp.Navigation Task FindImplementingSymbols (Compilation compilation, RefactoringSymbolInfo info, CancellationTokenSource cancellationTokenSource) { if (!TryGetInterfaceType (info, out var interfaceType, out var implementingType)) - return Task.FromResult (0); + return Task.CompletedTask; return Task.Run (delegate { var searchMonitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true); diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs index 4775b05ce5..8fb53e652f 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs @@ -1397,7 +1397,7 @@ namespace MonoDevelop.Debugger pinnedWatches.SetAllLiveUpdateBreakpoints (breakpoints); - return Task.FromResult (true); + return Task.CompletedTask; } static void OnSolutionClosed (object s, EventArgs args) diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs index 74a5a2c965..5c09463382 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs @@ -126,7 +126,7 @@ namespace MonoDevelop.Gettext.NodeBuilders UpdateTranslations (project, translation); } - static Task currentUpdateTranslationOperation = Task.FromResult (0); + static Task currentUpdateTranslationOperation = Task.CompletedTask; void UpdateTranslationsAsync (ProgressMonitor monitor, TranslationProject project, Translation translation) { diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs index 01e255d42a..0cadc4bcf3 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs @@ -157,7 +157,7 @@ namespace MonoDevelop.Gettext.NodeBuilders chooser.Dispose (); } } - static Task currentUpdateTranslationOperation = Task.FromResult (0); + static Task currentUpdateTranslationOperation = Task.CompletedTask; void UpdateTranslationsAsync (ProgressMonitor monitor, TranslationProject project) { diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCommonOperations.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCommonOperations.cs index 995fc8ac3c..f5b704b1e0 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCommonOperations.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopCommonOperations.cs @@ -36,7 +36,7 @@ namespace MonoDevelop.PackageManagement {
public Task CollapseAllNodes (ISolutionManager solutionManager)
{
- return Task.FromResult (0);
+ return Task.CompletedTask;
}
public Task OpenFile (string fullPath)
@@ -48,7 +48,7 @@ namespace MonoDevelop.PackageManagement public Task SaveSolutionExplorerNodeStates (ISolutionManager solutionManager)
{
- return Task.FromResult (0);
+ return Task.CompletedTask;
}
}
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopMSBuildNuGetProjectSystem.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopMSBuildNuGetProjectSystem.cs index 9d5dcee75a..3261ea8631 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopMSBuildNuGetProjectSystem.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/MonoDevelopMSBuildNuGetProjectSystem.cs @@ -283,7 +283,7 @@ namespace MonoDevelop.PackageManagement public Task BeginProcessingAsync ()
{
- return Task.FromResult (true);
+ return Task.CompletedTask;
}
// TODO: Support recursive.
@@ -304,7 +304,7 @@ namespace MonoDevelop.PackageManagement public Task EndProcessingAsync ()
{
- return Task.FromResult (true);
+ return Task.CompletedTask;
}
public bool FileExistsInProject (string path)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectExtensions.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectExtensions.cs index 9e405faacf..45bbbc864c 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectExtensions.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectExtensions.cs @@ -60,7 +60,7 @@ namespace MonoDevelop.PackageManagement return buildIntegratedProject.PostProcessAsync (context, token);
}
- return Task.FromResult (0);
+ return Task.CompletedTask;
}
public static void OnAfterExecuteActions (this NuGetProject project, IEnumerable<NuGetProjectAction> actions)
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectServices.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectServices.cs index 2f8a148ec3..d28b5fd3a3 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectServices.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/NuGetProjectServices.cs @@ -67,7 +67,7 @@ namespace MonoDevelop.PackageManagement public Task SaveProjectAsync (CancellationToken token) { - return Task.FromResult (0); + return Task.CompletedTask; } public Task<bool> ExecutePackageInitScriptAsync ( @@ -88,7 +88,7 @@ namespace MonoDevelop.PackageManagement bool throwOnFailure, CancellationToken token) { - return Task.FromResult (0); + return Task.CompletedTask; } } } diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementLogger.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementLogger.cs index e050f320aa..8b0e887581 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementLogger.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementLogger.cs @@ -98,13 +98,13 @@ namespace MonoDevelop.PackageManagement public Task LogAsync (LogLevel level, string data)
{
Log (level, data);
- return Task.FromResult (true);
+ return Task.CompletedTask;
}
public Task LogAsync (ILogMessage message)
{
Log (message);
- return Task.FromResult (true);
+ return Task.CompletedTask;
}
public void Log (LogLevel level, string data)
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs index 713146e524..e1971f465f 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs @@ -906,7 +906,7 @@ namespace MonoDevelop.SourceEditor {
var document = Document;
if (document == null)
- return TaskUtil.Default<object> ();
+ return Task.CompletedTask;
document.TextChanged -= OnTextReplaced; if (warnOverwrite) { @@ -970,7 +970,7 @@ namespace MonoDevelop.SourceEditor //document.AddMarker (7, new MyExtendingLineMarker ()); //document.AddMarker (10, new MyExtendingLineMarker ()); - return TaskUtil.Default<object> ();
+ return Task.CompletedTask;
}
void HandleTextEditorVAdjustmentChanged (object sender, EventArgs e) diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs index 0e2fb5832b..29c89bce8f 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs @@ -444,7 +444,7 @@ namespace MonoDevelop.TextEditor UpdateOptionsFromPolicy (); if (editorConfigContext == null) - return Task.FromResult (false); + return Task.CompletedTask; if (editorConfigContext.CurrentConventions.UniversalConventions.TryGetIndentStyle (out var indentStyle)) SetOptionValue (DefaultOptions.ConvertTabsToSpacesOptionName, indentStyle == IndentStyle.Spaces); @@ -486,7 +486,7 @@ namespace MonoDevelop.TextEditor EditorOptions.SetOptionValue (DefaultTextViewOptions.VerticalRulersName, verticalRulers ?? Array.Empty<int> ()); #endif - return Task.FromResult (true); + return Task.CompletedTask; } private void PolicyChanged (object sender, PolicyChangedEventArgs e) diff --git a/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTest.cs b/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTest.cs index da956f00ae..8a7bcce3bc 100644 --- a/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTest.cs +++ b/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTest.cs @@ -286,7 +286,7 @@ namespace MonoDevelop.UnitTesting // Forces the reloading of tests, if they have changed public virtual Task Refresh (CancellationToken ct) { - return Task.FromResult (0); + return Task.CompletedTask; } public UnitTestResult Run (TestContext testContext) @@ -336,7 +336,7 @@ namespace MonoDevelop.UnitTesting { if (parent != null) return parent.Build (); - return Task.FromResult (true); + return Task.CompletedTask; } public void RegisterResult (TestContext context, UnitTestResult result) diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs index efdbfd9b2f..bdf60945f5 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs @@ -459,7 +459,7 @@ namespace MonoDevelop.VersionControl.Views } CancellationTokenSource cancelUpdate = new CancellationTokenSource (); - Task updateTask = Task.FromResult (true); + Task updateTask = Task.CompletedTask; async Task RunUpdate (CancellationToken cancel) { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/IProgressMonitor.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/IProgressMonitor.cs index 8f728d8422..b1a4aa1853 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/IProgressMonitor.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/IProgressMonitor.cs @@ -44,11 +44,11 @@ namespace MonoDevelop.Core public class AsyncOperation { - public static AsyncOperation CompleteOperation = new AsyncOperation (Task.FromResult(0), null); + public static AsyncOperation CompleteOperation = new AsyncOperation (Task.CompletedTask, null); protected AsyncOperation () { - Task = Task.FromResult (0); + Task = Task.CompletedTask; CancellationTokenSource = new CancellationTokenSource (); } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs index 4bb348eddc..e506fd1cd4 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs @@ -201,7 +201,7 @@ namespace MonoDevelop.Projects internal protected override Task OnSave (ProgressMonitor monitor) { // Compiled assemblies can't be saved - return Task.FromResult (0); + return Task.CompletedTask; } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs index fcd55fd427..b2fd9b91ad 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs @@ -2433,9 +2433,9 @@ namespace MonoDevelop.Projects ProjectConfiguration config = GetConfiguration (configuration) as ProjectConfiguration; if (config == null) monitor.ReportError (GettextCatalog.GetString ("Configuration '{0}' not found in project '{1}'", configuration, Name), null); - return Task.FromResult (0); + return Task.CompletedTask; } - + /// <summary> /// Gets the absolute path to the output file generated by this project. /// </summary> diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs index 4947097439..5986e425e5 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs @@ -925,7 +925,7 @@ namespace MonoDevelop.Projects /*protected virtual*/ Task OnPrepareExecution (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, SolutionRunConfiguration runConfiguration) { - return Task.FromResult (0); + return Task.CompletedTask; } /*protected virtual*/ void OnStartupItemChanged(EventArgs e) diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs index 725a7b2cf3..0047fd2b8d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs @@ -399,7 +399,7 @@ namespace MonoDevelop.Projects public Task Execute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { - return Task.FromResult (false); + return Task.CompletedTask; } public bool CanExecute (ExecutionContext context, ConfigurationSelector configuration) @@ -409,7 +409,7 @@ namespace MonoDevelop.Projects public Task PrepareExecution (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { - return Task.FromResult (false); + return Task.CompletedTask; } // note: although executing folders isn't supported, this may still get called when diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs index fcbc1dd7a7..1cb0bdf6bc 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs @@ -1080,7 +1080,7 @@ namespace MonoDevelop.Projects [Obsolete ("Use overload that takes a RunConfiguration")] protected virtual Task OnExecute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { - return Task.FromResult (0); + return Task.CompletedTask; } /// <summary> @@ -1105,7 +1105,7 @@ namespace MonoDevelop.Projects [Obsolete ("Use overload that takes a RunConfiguration")] protected virtual Task OnPrepareExecution (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { - return Task.FromResult (true); + return Task.CompletedTask; } bool DoGetCanExecute (ExecutionContext context, ConfigurationSelector configuration, SolutionItemRunConfiguration runConfiguration) diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownSolutionItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownSolutionItem.cs index e718d5e03c..e89aa6476e 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownSolutionItem.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/UnknownSolutionItem.cs @@ -101,7 +101,7 @@ namespace MonoDevelop.Projects protected internal override Task OnSave (ProgressMonitor monitor) { - return Task.FromResult (0); + return Task.CompletedTask; } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceItem.cs index dafbe867f6..2927163932 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceItem.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/WorkspaceItem.cs @@ -280,7 +280,7 @@ namespace MonoDevelop.Projects protected internal virtual Task OnSave (ProgressMonitor monitor) { - return Task.FromResult (0); + return Task.CompletedTask; } public virtual bool NeedsReload { @@ -330,7 +330,7 @@ namespace MonoDevelop.Projects { Loading = false; fileStatusTracker.ResetLoadTimes (); - return Task.FromResult (true); + return Task.CompletedTask; } /// <summary> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs index 6000fa4153..ad93550190 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs @@ -158,20 +158,20 @@ namespace MonoDevelop.Ide.Editor } } } - static Task finishedTask = Task.FromResult (true); + internal static Task InformAutoSaveThread (ITextSource content, string fileName, bool isDirty) { if (content == null) throw new ArgumentNullException (nameof (content)); if (!autoSaveEnabled || string.IsNullOrEmpty (fileName)) - return finishedTask; + return Task.CompletedTask; if (isDirty) { return Task.Run (() => { CreateAutoSave (fileName, content); }); } else { RemoveAutoSaveFile (fileName); - return finishedTask; + return Task.CompletedTask; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs index cc9805e70f..53745babf6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs @@ -333,7 +333,7 @@ namespace MonoDevelop.Ide.Editor private Task UpdateContextOptions (object sender, CodingConventionsChangedEventArgs arg) { if (context == null) - return Task.FromResult (false); + return Task.CompletedTask; bool followCodingConventions = IdeApp.Preferences.Editor.FollowCodingConventions; @@ -368,7 +368,7 @@ namespace MonoDevelop.Ide.Editor } } this.FireChange (); - return Task.FromResult (true); + return Task.CompletedTask; } #region new options diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs index cc9212fe44..6ada8f0715 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs @@ -97,7 +97,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public async void OnReload () { var solutions = new HashSet<Solution> (); - Task task = Task.FromResult (0); + Task task = Task.CompletedTask; using (ProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) { m.BeginTask (null, CurrentNodes.Length); foreach (ITreeNavigator node in CurrentNodes) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs index 94ee7d76f6..b99021a5cc 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs @@ -141,7 +141,7 @@ namespace MonoDevelop.Ide.Gui.Wizard protected virtual Task OnCompleted (CancellationToken token) { - return Task.FromResult (true); + return Task.CompletedTask; } protected virtual void OnPropertyChanged (string propertyName) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs index 4d504a8668..90185898da 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs @@ -377,7 +377,7 @@ namespace MonoDevelop.Ide.Gui public ITextBuffer TextBuffer => GetContent<ITextBuffer> (); - Task currentOperationTask = Task.FromResult (true); + Task currentOperationTask = Task.CompletedTask; Task RunAsyncOperation (Func<Task> action) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs index 7b223911fe..0294419425 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs @@ -75,7 +75,7 @@ namespace MonoDevelop.Ide.Templates var fileName = StringParserService.Parse (name, model); project.ProjectProperties.SetValue (typeAtt.Value, string.IsNullOrEmpty (fileName) ? propertyInnerText : string.Concat (fileName, extension)); - return Task.FromResult(true); + return Task.FromResult (true); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs index 0cea504e70..0032dd5951 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs @@ -997,7 +997,7 @@ namespace MonoDevelop.Ide.TypeSystem /// Used by tests to validate that project has been saved.
/// </summary>
/// <value>The task that can be awaited to validate saving has finished.</value>
- internal Task ProjectSaveTask { get; private set; } = Task.FromResult<object> (null);
+ internal Task ProjectSaveTask { get; private set; } = Task.CompletedTask;
internal override bool TryApplyChanges (Solution newSolution, IProgressTracker progressTracker)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs index d324842b72..190e9db83b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs @@ -529,7 +529,7 @@ namespace MonoDevelop.Ide return SaveAsync ((IWorkspaceFileObject)item); if (item.ParentObject != null) return SaveAsync (item.ParentObject); - return Task.FromResult (0); + return Task.CompletedTask; } async Task SaveAsync (IWorkspaceFileObject item) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs index c3303b93ab..0b95aad703 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs @@ -429,7 +429,7 @@ namespace MonoDevelop.Ide Task IBuildTarget.PrepareExecution (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { - return Task.FromResult (0); + return Task.CompletedTask; } public Task Execute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) |