private async Task SerializeDiagnosticResultAsync(string streamName, DiagnosticAnalysisResultMap <string, DiagnosticAnalysisResultBuilder> result)
        {
            using (var stream = await DirectStream.GetAsync(streamName, CancellationToken).ConfigureAwait(false))
            {
                using (var writer = new ObjectWriter(stream))
                {
                    DiagnosticResultSerializer.Serialize(writer, result, CancellationToken);
                }

                await stream.FlushAsync(CancellationToken).ConfigureAwait(false);
            }
        }
Exemplo n.º 2
0
        private async Task SerializeDiagnosticResultAsync(string streamName, DiagnosticAnalysisResultMap <string, DiagnosticAnalysisResultBuilder> result)
        {
            using (RoslynLogger.LogBlock(FunctionId.CodeAnalysisService_SerializeDiagnosticResultAsync, GetResultLogInfo, result, CancellationToken))
                using (var stream = await DirectStream.GetAsync(streamName, CancellationToken).ConfigureAwait(false))
                {
                    using (var writer = new StreamObjectWriter(stream))
                    {
                        DiagnosticResultSerializer.Serialize(writer, result, CancellationToken);
                    }

                    await stream.FlushAsync(CancellationToken).ConfigureAwait(false);
                }
        }
Exemplo n.º 3
0
        private async Task SerializeDiagnosticResultAsync(string streamName, DiagnosticAnalysisResultMap <string, DiagnosticAnalysisResultBuilder> result, CancellationToken cancellationToken)
        {
            using (RoslynLogger.LogBlock(FunctionId.CodeAnalysisService_SerializeDiagnosticResultAsync, GetResultLogInfo, result, cancellationToken))
                using (var stream = await DirectStream.GetAsync(streamName, cancellationToken).ConfigureAwait(false))
                {
                    using (var writer = new ObjectWriter(stream))
                    {
                        var info = DiagnosticResultSerializer.Serialize(writer, result, cancellationToken);

                        // save log for debugging
                        Log(TraceEventType.Information, $"diagnostics: {info.diagnostics}, telemetry: {info.telemetry}, exceptions: {info.exceptions}");
                    }

                    await stream.FlushAsync(cancellationToken).ConfigureAwait(false);
                }
        }