/// <summary> /// Transform this task into <see cref="ViewableProperty{T}"/>. Task could be finished by exception so we need /// </summary> /// <param name="task"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> [PublicAPI] public static IReadonlyProperty <Result <T> > ToResultProperty <T>([NotNull] this Task <T> task) { if (task == null) { throw new ArgumentNullException(nameof(task)); } var res = new ViewableProperty <Result <T> >(); task.ContinueWith(t => { res.Value = Result.FromCompletedTask(t); }, TaskContinuationOptions.ExecuteSynchronously); return(res); }
public UnityNUnitServiceProvider(ISolution solution, IPsiModules psiModules, ISymbolCache symbolCache, IUnitTestElementIdFactory idFactory, IUnitTestElementManager elementManager, NUnitTestProvider provider, ISettingsStore settingsStore, ISettingsOptimization settingsOptimization, ISettingsCache settingsCache, UnitTestingCachingService cachingService, IDotNetCoreSdkResolver dotNetCoreSdkResolver, UnityEditorProtocol editorProtocol, RunViaUnityEditorStrategy runViaUnityEditorStrategy, NUnitOutOfProcessUnitTestRunStrategy nUnitOutOfProcessUnitTestRunStrategy) : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settingsStore, settingsOptimization, settingsCache, cachingService, dotNetCoreSdkResolver, nUnitOutOfProcessUnitTestRunStrategy) { if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null) { return; } myRdUnityModel = solution.GetProtocolSolution().GetRdUnityModel(); myEditorModel = editorProtocol.UnityModel; myUnityEditorStrategy = runViaUnityEditorStrategy; }
public DeferredCacheController(Lifetime lifetime, ISolution solution, SolutionCaches solutionCaches, ISolutionLoadTasksScheduler tasksScheduler, IPersistentIndexManager persistentIndexManager, IPsiFiles psiFiles, SolutionAnalysisConfiguration solutionAnalysisConfiguration, IShellLocks shellLocks, DeferredHelperCache deferredHelperCache, IEnumerable <IDeferredCache> deferredCaches, DeferredCacheProgressBar progressBar, ILogger logger) { myLifetime = lifetime; mySolution = solution; mySolutionCaches = solutionCaches; myPsiFiles = psiFiles; mySolutionAnalysisConfiguration = solutionAnalysisConfiguration; myShellLocks = shellLocks; myDeferredHelperCache = deferredHelperCache; myDeferredCaches = deferredCaches; myProgressBar = progressBar; myLogger = logger; var defaultValue = solutionCaches.PersistentProperties.TryGetValue("DeferredCachesCompletedOnce", out var result) && result.Equals("True"); myCompletedOnce = new ViewableProperty <bool>(defaultValue); myGroupingEvent = solution.Locks.GroupingEvents.CreateEvent(lifetime, "DeferredCachesCoreActivity", TimeSpan.FromMilliseconds(500), Rgc.Guarded, RunBackgroundActivity); }