/// <summary> /// This is top level entry point for diagnostic calculation from client (VS). /// /// This will be called by ServiceHub/JsonRpc framework /// </summary> public async Task CalculateDiagnosticsAsync(DiagnosticArguments arguments, string streamName) { using (RoslynLogger.LogBlock(FunctionId.CodeAnalysisService_CalculateDiagnosticsAsync, arguments.ProjectIdDebugName, CancellationToken)) { try { var optionSet = await RoslynServices.AssetService.GetAssetAsync <OptionSet>(arguments.GetOptionSetChecksum(), CancellationToken).ConfigureAwait(false); // entry point for diagnostic service var solution = await GetSolutionWithSpecificOptionsAsync(optionSet).ConfigureAwait(false); var projectId = arguments.GetProjectId(); var analyzers = await GetHostAnalyzerReferences(arguments.GetHostAnalyzerChecksums()).ConfigureAwait(false); var result = await(new DiagnosticComputer(solution.GetProject(projectId))).GetDiagnosticsAsync( analyzers, arguments.AnalyzerIds, arguments.ReportSuppressedDiagnostics, arguments.LogAnalyzerExecutionTime, CancellationToken).ConfigureAwait(false); await SerializeDiagnosticResultAsync(streamName, result).ConfigureAwait(false); } catch (IOException) { // stream to send over result has closed before we // had chance to check cancellation } catch (OperationCanceledException) { // rpc connection has closed. // this can happen if client side cancelled the // operation } } }
/// <summary> /// This is top level entry point for diagnostic calculation from client (VS). /// /// This will be called by ServiceHub/JsonRpc framework /// </summary> public async Task CalculateDiagnosticsAsync(DiagnosticArguments arguments, byte[] solutionChecksum, string streamName) { try { // entry point for diagnostic service var solution = await RoslynServices.SolutionService.GetSolutionAsync(new Checksum(solutionChecksum), CancellationToken).ConfigureAwait(false); var projectId = arguments.GetProjectId(); var analyzers = await GetHostAnalyzerReferences(arguments.GetHostAnalyzerChecksums()).ConfigureAwait(false); var result = await(new DiagnosticComputer(solution.GetProject(projectId))).GetDiagnosticsAsync( analyzers, arguments.AnalyzerIds, arguments.ReportSuppressedDiagnostics, arguments.LogAnalyzerExecutionTime, CancellationToken).ConfigureAwait(false); await SerializeDiagnosticResultAsync(streamName, result).ConfigureAwait(false); } catch (IOException) { // stream to send over result has closed before we // had chance to check cancellation } catch (OperationCanceledException) { // rpc connection has closed. // this can happen if client side cancelled the // operation } }