private async Task OnProjectChangedAsync( IProjectSubscriptionUpdate projectUpdate, IProjectCatalogSnapshot catalogSnapshot, IProjectCapabilitiesSnapshot capabilities, ConfiguredProject configuredProject, RuleHandlerType handlerType) { if (IsDisposing || IsDisposed) { return; } // Ensure updates don't overlap and that we aren't disposed during the update without cleaning up properly await ExecuteUnderLockAsync(async token => { // Ensure the project doesn't unload during the update await _tasksService.LoadedProjectAsync(async() => { // TODO pass _tasksService.UnloadCancellationToken into handler to reduce redundant work on unload // Ensure the project's capabilities don't change during the update using (ProjectCapabilitiesContext.CreateIsolatedContext(configuredProject, capabilities)) { await HandleAsync(projectUpdate, catalogSnapshot, handlerType); } }); }); }
private async Task OnProjectChangedAsync( IProjectSubscriptionUpdate projectUpdate, IProjectCatalogSnapshot catalogSnapshot, IProjectCapabilitiesSnapshot capabilities, ConfiguredProject configuredProject, RuleHandlerType handlerType) { if (IsDisposing || IsDisposed) { return; } await _tasksService.LoadedProjectAsync(async() => { if (_tasksService.UnloadCancellationToken.IsCancellationRequested) { return; } using (ProjectCapabilitiesContext.CreateIsolatedContext(configuredProject, capabilities)) { await HandleAsync(projectUpdate, catalogSnapshot, handlerType); } }); }