protected override void Initialize() { base.Initialize(); ForegroundThreadAffinitizedObject.Initialize(); FatalError.Handler = FailFast.OnFatalException; FatalError.NonFatalHandler = WatsonReporter.Report; // We also must set the FailFast handler for the compiler layer as well var compilerAssembly = typeof(Compilation).Assembly; var compilerFatalError = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true); var property = compilerFatalError.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public); var compilerFailFast = compilerAssembly.GetType(typeof(FailFast).FullName, throwOnError: true); var method = compilerFailFast.GetMethod(nameof(FailFast.OnFatalException), BindingFlags.Static | BindingFlags.NonPublic); property.SetValue(null, Delegate.CreateDelegate(property.PropertyType, method)); RegisterFindResultsLibraryManager(); var componentModel = (IComponentModel)this.GetService(typeof(SComponentModel)); _workspace = componentModel.GetService<VisualStudioWorkspace>(); var telemetrySetup = componentModel.GetService<IRoslynTelemetrySetup>(); telemetrySetup?.Initialize(this); // set workspace output pane _outputPane = new WorkspaceFailureOutputPane(this, _workspace); InitializeColors(); // load some services that have to be loaded in UI thread LoadComponentsInUIContext(); _solutionBuildMonitor = new SolutionBuildMonitor(_workspace); }
protected override void Initialize() { base.Initialize(); ForegroundThreadAffinitizedObject.CurrentForegroundThreadData = ForegroundThreadData.CreateDefault(); Debug.Assert( ForegroundThreadAffinitizedObject.CurrentForegroundThreadData.Kind == ForegroundThreadDataKind.Wpf || ForegroundThreadAffinitizedObject.CurrentForegroundThreadData.Kind == ForegroundThreadDataKind.JoinableTask); FatalError.Handler = FailFast.OnFatalException; FatalError.NonFatalHandler = WatsonReporter.Report; // We also must set the FailFast handler for the compiler layer as well var compilerAssembly = typeof(Compilation).Assembly; var compilerFatalError = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true); var property = compilerFatalError.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public); var compilerFailFast = compilerAssembly.GetType(typeof(FailFast).FullName, throwOnError: true); var method = compilerFailFast.GetMethod(nameof(FailFast.OnFatalException), BindingFlags.Static | BindingFlags.NonPublic); property.SetValue(null, Delegate.CreateDelegate(property.PropertyType, method)); InitializePortableShim(compilerAssembly); RegisterFindResultsLibraryManager(); var componentModel = (IComponentModel)this.GetService(typeof(SComponentModel)); _workspace = componentModel.GetService <VisualStudioWorkspace>(); var telemetrySetupExtensions = componentModel.GetExtensions <IRoslynTelemetrySetup>(); foreach (var telemetrySetup in telemetrySetupExtensions) { telemetrySetup.Initialize(this); } // set workspace output pane _outputPane = new WorkspaceFailureOutputPane(this, _workspace); InitializeColors(); // load some services that have to be loaded in UI thread LoadComponentsInUIContext(); _solutionEventMonitor = new SolutionEventMonitor(_workspace); }
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true); await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _componentModel = (IComponentModel) await GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(true); cancellationToken.ThrowIfCancellationRequested(); Assumes.Present(_componentModel); FatalError.Handler = FailFast.OnFatalException; FatalError.NonFatalHandler = WatsonReporter.Report; // We also must set the FailFast handler for the compiler layer as well var compilerAssembly = typeof(Compilation).Assembly; var compilerFatalError = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true); var property = compilerFatalError.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public); var compilerFailFast = compilerAssembly.GetType(typeof(FailFast).FullName, throwOnError: true); var method = compilerFailFast.GetMethod(nameof(FailFast.OnFatalException), BindingFlags.Static | BindingFlags.NonPublic); property.SetValue(null, Delegate.CreateDelegate(property.PropertyType, method)); _workspace = _componentModel.GetService <VisualStudioWorkspace>(); _workspace.Services.GetService <IExperimentationService>(); // Ensure the options persisters are loaded since we have to fetch options from the shell _componentModel.GetExtensions <IOptionPersister>(); RoslynTelemetrySetup.Initialize(this); // set workspace output pane _outputPane = new WorkspaceFailureOutputPane(_componentModel.GetService <IThreadingContext>(), this, _workspace); InitializeColors(); // load some services that have to be loaded in UI thread LoadComponentsInUIContextOnceSolutionFullyLoadedAsync(cancellationToken).Forget(); _solutionEventMonitor = new SolutionEventMonitor(_workspace); TrackBulkFileOperations(); RegisterCodeCleanupProvider(); }
protected override void Initialize() { base.Initialize(); // Assume that we are being initialized on the UI thread at this point. ForegroundThreadAffinitizedObject.CurrentForegroundThreadData = ForegroundThreadData.CreateDefault(defaultKind: ForcedByPackageInitialize); Debug.Assert(ForegroundThreadAffinitizedObject.CurrentForegroundThreadData.Kind != Unknown); FatalError.Handler = FailFast.OnFatalException; FatalError.NonFatalHandler = WatsonReporter.Report; // We also must set the FailFast handler for the compiler layer as well var compilerAssembly = typeof(Compilation).Assembly; var compilerFatalError = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true); var property = compilerFatalError.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public); var compilerFailFast = compilerAssembly.GetType(typeof(FailFast).FullName, throwOnError: true); var method = compilerFailFast.GetMethod(nameof(FailFast.OnFatalException), BindingFlags.Static | BindingFlags.NonPublic); property.SetValue(null, Delegate.CreateDelegate(property.PropertyType, method)); InitializePortableShim(compilerAssembly); RegisterFindResultsLibraryManager(); var componentModel = (IComponentModel)this.GetService(typeof(SComponentModel)); _workspace = componentModel.GetService<VisualStudioWorkspace>(); var telemetrySetupExtensions = componentModel.GetExtensions<IRoslynTelemetrySetup>(); foreach (var telemetrySetup in telemetrySetupExtensions) { telemetrySetup.Initialize(this); } // set workspace output pane _outputPane = new WorkspaceFailureOutputPane(this, _workspace); InitializeColors(); // load some services that have to be loaded in UI thread LoadComponentsInUIContext(); _solutionEventMonitor = new SolutionEventMonitor(_workspace); }
protected override void Initialize() { base.Initialize(); FatalError.Handler = FailFast.OnFatalException; FatalError.NonFatalHandler = WatsonReporter.Report; // We also must set the FailFast handler for the compiler layer as well var compilerAssembly = typeof(Compilation).Assembly; var compilerFatalError = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true); var property = compilerFatalError.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public); var compilerFailFast = compilerAssembly.GetType(typeof(FailFast).FullName, throwOnError: true); var method = compilerFailFast.GetMethod(nameof(FailFast.OnFatalException), BindingFlags.Static | BindingFlags.NonPublic); property.SetValue(null, Delegate.CreateDelegate(property.PropertyType, method)); RegisterFindResultsLibraryManager(); var componentModel = (IComponentModel)this.GetService(typeof(SComponentModel)); _workspace = componentModel.GetService <VisualStudioWorkspace>(); // Ensure the options persisters are loaded since we have to fetch options from the shell componentModel.GetExtensions <IOptionPersister>(); var telemetrySetupExtensions = componentModel.GetExtensions <IRoslynTelemetrySetup>(); foreach (var telemetrySetup in telemetrySetupExtensions) { telemetrySetup.Initialize(this); } // set workspace output pane _outputPane = new WorkspaceFailureOutputPane(this, _workspace); InitializeColors(); // load some services that have to be loaded in UI thread LoadComponentsInUIContextOnceSolutionFullyLoaded(); _solutionEventMonitor = new SolutionEventMonitor(_workspace); }