Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 7b0c842

Browse files
committed
Nullable: CompositionManager
1 parent 900014b commit 7b0c842

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/CompositionManager.Caching.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2424
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2525
// THE SOFTWARE.
26+
#nullable enable
2627
using System;
2728
using System.Collections.Generic;
2829
using System.IO;
@@ -63,16 +64,16 @@ public virtual void HandleException (string message, Exception e)
6364
/// </summary>
6465
internal class Caching
6566
{
66-
readonly ICachingFaultInjector cachingFaultInjector;
67+
readonly ICachingFaultInjector? cachingFaultInjector;
6768
readonly RuntimeCompositionExceptionHandler exceptionHandler;
6869

69-
Task saveTask;
70+
Task saveTask = Task.CompletedTask;
7071
readonly HashSet<Assembly> loadedAssemblies;
7172
public HashSet<Assembly> MefAssemblies { get; }
7273
internal string MefCacheFile { get; }
7374
internal string MefCacheControlFile { get; }
7475

75-
public Caching (HashSet<Assembly> mefAssemblies, RuntimeCompositionExceptionHandler exceptionHandler, Func<string, string> getCacheFilePath = null, ICachingFaultInjector cachingFaultInjector = null)
76+
public Caching (HashSet<Assembly> mefAssemblies, RuntimeCompositionExceptionHandler exceptionHandler, Func<string, string>? getCacheFilePath = null, ICachingFaultInjector? cachingFaultInjector = null)
7677
{
7778
getCacheFilePath = getCacheFilePath ?? (file => Path.Combine (AddinManager.CurrentAddin.PrivateDataPath, file));
7879

@@ -97,7 +98,7 @@ void IdeApp_Exiting (object sender, ExitEventArgs args)
9798
// As of the time this code was written, serializing the cache takes 200ms.
9899
// Maybe show a dialog and progress bar here that we're closing after save.
99100
// We cannot cancel the save, vs-mef doesn't use the cancellation tokens in the API.
100-
saveTask?.Wait ();
101+
saveTask.Wait ();
101102
}
102103

103104
internal Stream OpenCacheStream () => File.Open (MefCacheFile, FileMode.Open);
@@ -165,7 +166,7 @@ internal bool CanUse (bool handleExceptions = true)
165166
return true;
166167
}
167168

168-
static bool ValidateAssemblyCacheListIntegrity (HashSet<Assembly> assemblies, List<MefControlCacheAssemblyInfo> cachedAssemblyInfos, ICachingFaultInjector cachingFaultInjector)
169+
static bool ValidateAssemblyCacheListIntegrity (HashSet<Assembly> assemblies, List<MefControlCacheAssemblyInfo> cachedAssemblyInfos, ICachingFaultInjector? cachingFaultInjector)
169170
{
170171
var currentAssemblies = new Dictionary<string, Guid> (assemblies.Count);
171172
foreach (var asm in assemblies)
@@ -203,7 +204,7 @@ internal Task Write (RuntimeComposition runtimeComposition, ComposableCatalog ca
203204
await saveTask;
204205

205206
IdeApp.Exiting -= IdeApp_Exiting;
206-
saveTask = null;
207+
saveTask = Task.CompletedTask;
207208
});
208209
}
209210

0 commit comments

Comments
 (0)