diff --git a/src/AddIns/Analysis/UnitTesting/Frameworks/ITestFramework.cs b/src/AddIns/Analysis/UnitTesting/Model/ITestFramework.cs
similarity index 100%
rename from src/AddIns/Analysis/UnitTesting/Frameworks/ITestFramework.cs
rename to src/AddIns/Analysis/UnitTesting/Model/ITestFramework.cs
diff --git a/src/AddIns/Analysis/UnitTesting/Frameworks/ITestService.cs b/src/AddIns/Analysis/UnitTesting/Service/ITestService.cs
similarity index 100%
rename from src/AddIns/Analysis/UnitTesting/Frameworks/ITestService.cs
rename to src/AddIns/Analysis/UnitTesting/Service/ITestService.cs
diff --git a/src/AddIns/Analysis/UnitTesting/Frameworks/SDTestService.cs b/src/AddIns/Analysis/UnitTesting/Service/SDTestService.cs
similarity index 100%
rename from src/AddIns/Analysis/UnitTesting/Frameworks/SDTestService.cs
rename to src/AddIns/Analysis/UnitTesting/Service/SDTestService.cs
diff --git a/src/AddIns/Analysis/UnitTesting/Frameworks/TestFrameworkDescriptor.cs b/src/AddIns/Analysis/UnitTesting/Service/TestFrameworkDescriptor.cs
similarity index 100%
rename from src/AddIns/Analysis/UnitTesting/Frameworks/TestFrameworkDescriptor.cs
rename to src/AddIns/Analysis/UnitTesting/Service/TestFrameworkDescriptor.cs
diff --git a/src/AddIns/Analysis/UnitTesting/Frameworks/TestFrameworkDoozer.cs b/src/AddIns/Analysis/UnitTesting/Service/TestFrameworkDoozer.cs
similarity index 100%
rename from src/AddIns/Analysis/UnitTesting/Frameworks/TestFrameworkDoozer.cs
rename to src/AddIns/Analysis/UnitTesting/Service/TestFrameworkDoozer.cs
diff --git a/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj b/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj
index 3eede71d50..dc4cbf9f4f 100644
--- a/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj
+++ b/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj
@@ -70,14 +70,14 @@
-
+
+
-
@@ -105,9 +105,9 @@
-
-
-
+
+
+
@@ -181,7 +181,7 @@
-
+
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.addin b/src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
index d9e5a12b87..dcb3047376 100755
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
@@ -62,6 +62,8 @@
class="ICSharpCode.SharpDevelop.Parser.AssemblyParserService"/>
+
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index ffa7493b77..872ae82fee 100644
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
@@ -411,6 +411,7 @@
+
@@ -746,6 +747,7 @@
+
diff --git a/src/Main/Base/Project/Src/Services/IShutdownService.cs b/src/Main/Base/Project/Src/Services/IShutdownService.cs
new file mode 100644
index 0000000000..6f5bd90224
--- /dev/null
+++ b/src/Main/Base/Project/Src/Services/IShutdownService.cs
@@ -0,0 +1,63 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace ICSharpCode.SharpDevelop
+{
+ ///
+ /// Service that manages the IDE shutdown, and any questions.
+ ///
+ public interface IShutdownService
+ {
+ ///
+ /// Attemps to close the IDE.
+ ///
+ ///
+ /// This method will
+ /// - Check if was called and abort the shutdown if it was.
+ /// - Prompt the user to save the open files. The user has the option to cancel the shutdown at that point.
+ /// - Closes the solution.
+ /// - Signals the .
+ /// - Disposes pads
+ /// - Wait for background tasks () to finish.
+ /// - Disposes services
+ /// - Saves the PropertyService
+ ///
+ /// This method must be called on the main thread.
+ ///
+ bool Shutdown();
+
+ ///
+ /// Prevents shutdown with the following reason.
+ /// Dispose the returned value to allow shutdown again.
+ ///
+ /// The reason. This parameter will be passed through the StringParser when the reason is displayed to the user.
+ /// Shutdown is already in progress
+ /// This method is thread-safe.
+ IDisposable PreventShutdown(string reason);
+
+ ///
+ /// Gets the current reason that prevents shutdown.
+ /// If there isn't any reason, returns null.
+ /// If there are multiple reasons, this returns one of them.
+ ///
+ /// This method is thread-safe.
+ string CurrentReasonPreventingShutdown { get; }
+
+ ///
+ /// Gets a cancellation token that gets signalled when SharpDevelop is shutting down.
+ ///
+ CancellationToken ShutdownToken { get; }
+
+ ///
+ /// Adds a background task on which SharpDevelop should wait on shutdown.
+ ///
+ /// Use this method for tasks that asynchronously write state to disk and should not be
+ /// interrupted by SharpDevelop closing down.
+ ///
+ void AddBackgroundTask(Task task);
+ }
+}
diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs
index 86119ae365..53d0a7b9b6 100644
--- a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs
+++ b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs
@@ -8,7 +8,6 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
-
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
@@ -16,6 +15,7 @@ using ICSharpCode.NRefactory.TypeSystem.Implementation;
using ICSharpCode.NRefactory.Utils;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
+using ICSharpCode.SharpDevelop.Util;
namespace ICSharpCode.SharpDevelop.Parser
{
@@ -101,7 +101,7 @@ namespace ICSharpCode.SharpDevelop.Parser
{
if (cacheFileName == null)
return Task.FromResult