Example #1
0
        private void OnActiveSolutionChanged(object sender, ActiveSolutionTrackerEventArgs args)
        {
            // TODO: simplifying the eventing model.
            // Both this class and the ActiveSolutionBoundTracker both listen for solution closing events.
            // The ASBT can set the current configuration to Standalone, and this class reads the
            // configuration. However, we can't control the order they receive the "solution closing"
            // notification, so this class might try to read the configuration before it has been
            // updated by the ASBT.
            // To work round this, we have specifically check whether there is an open solution
            // so we do the right thing here.

            // Reset, and abort workflows
            this.ResetBinding(abortCurrentlyRunningWorklows: true, clearCurrentBinding: !args.IsSolutionOpen);
        }
        private async void OnActiveSolutionChanged(object sender, ActiveSolutionTrackerEventArgs args)
        {
            // An exception here will crash VS
            try
            {
                if (!args.IsSolutionOpen)
                {
                    this.configurationProvider.WriteConfiguration(BindingConfiguration.Standalone);
                }

                await UpdateConnection();

                this.RaiseAnalyzersChangedIfBindingChanged();
                this.errorListInfoBarController.Refresh();
            }
            catch (Exception ex) when(!Microsoft.VisualStudio.ErrorHandler.IsCriticalException(ex))
            {
                logger.WriteLine($"Error handling solution change: {ex.Message}");
            }
        }