예제 #1
0
        private void SetGlobalContext(int uiCultureLCID, int cultureLCID, string?serializedSession)
        {
            // set global telemetry session
            var session = GetTelemetrySession(serializedSession);

            if (session == null)
            {
                return;
            }

            EnsureCulture(uiCultureLCID, cultureLCID);

            // set roslyn loggers
            RoslynServices.SetTelemetrySession(session);

            RoslynLogger.SetLogger(AggregateLogger.Create(new VSTelemetryLogger(session), RoslynLogger.GetLogger()));

            // set both handler as NFW
            FatalError.Handler         = ex => WatsonReporter.Report(ex, WatsonSeverity.Critical);
            FatalError.NonFatalHandler = ex => WatsonReporter.Report(ex);

            // start performance reporter
            var diagnosticAnalyzerPerformanceTracker = SolutionService.PrimaryWorkspace.Services.GetService <IPerformanceTrackerService>();

            if (diagnosticAnalyzerPerformanceTracker != null)
            {
                var globalOperationNotificationService = SolutionService.PrimaryWorkspace.Services.GetService <IGlobalOperationNotificationService>();
                _performanceReporter = new PerformanceReporter(Logger, diagnosticAnalyzerPerformanceTracker, globalOperationNotificationService, s_reportInterval, _shutdownCancellationSource.Token);
            }
        }
예제 #2
0
        private void SetGlobalContext(int uiCultureLCID, int cultureLCID, string serializedSession)
        {
            var session = new TelemetrySession(serializedSession);

            session.Start();

            EnsureCulture(uiCultureLCID, cultureLCID);

            WatsonReporter.InitializeFatalErrorHandlers(session);
            WatsonReporter.InitializeLogger(Logger);

            // set roslyn loggers
            RoslynServices.SetTelemetrySession(session);

            RoslynLogger.SetLogger(AggregateLogger.Create(new VSTelemetryLogger(session), RoslynLogger.GetLogger()));

            // start performance reporter
            var diagnosticAnalyzerPerformanceTracker = SolutionService.PrimaryWorkspace.Services.GetService <IPerformanceTrackerService>();

            if (diagnosticAnalyzerPerformanceTracker != null)
            {
                var globalOperationNotificationService = SolutionService.PrimaryWorkspace.Services.GetService <IGlobalOperationNotificationService>();
                _performanceReporter = new PerformanceReporter(Logger, diagnosticAnalyzerPerformanceTracker, globalOperationNotificationService, s_reportInterval, _shutdownCancellationSource.Token);
            }
        }
예제 #3
0
        protected Task <Solution> GetSolutionAsync(PinnedSolutionInfo solutionInfo, CancellationToken cancellationToken)
        {
            var localRoslynService = new RoslynServices(solutionInfo.ScopeId, AssetStorage);

            return(GetSolutionAsync(localRoslynService, solutionInfo, cancellationToken));
        }
예제 #4
0
        private static Task <Solution> GetSolutionAsync(RoslynServices roslynService, PinnedSolutionInfo solutionInfo, CancellationToken cancellationToken)
        {
            var solutionController = (ISolutionController)roslynService.SolutionService;

            return(solutionController.GetSolutionAsync(solutionInfo.SolutionChecksum, solutionInfo.FromPrimaryBranch, cancellationToken));
        }
예제 #5
0
 public virtual void Initialize(PinnedSolutionInfo info)
 {
     // set pinned solution info
     _lazyRoslynServices = null;
     _solutionInfo       = info;
 }
예제 #6
0
 public TestAccessor(RoslynServices roslynServices)
 {
     _roslynServices = roslynServices;
 }