Exemple #1
0
 private async Task <DesignerAttributeResult> ScanDesignerAttributesInRemoteHostAsync(RemoteHostClient client, Document document, CancellationToken cancellationToken)
 {
     return(await client.TryRunCodeAnalysisRemoteAsync <DesignerAttributeResult>(
                document.Project.Solution,
                nameof(IRemoteDesignerAttributeService.ScanDesignerAttributesAsync),
                document.Id,
                cancellationToken).ConfigureAwait(false));
 }
        private async Task <IList <TodoComment> > GetTodoCommentsInRemoteHostAsync(
            RemoteHostClient client, Document document, IList <TodoCommentDescriptor> commentDescriptors, CancellationToken cancellationToken)
        {
            var result = await client.TryRunCodeAnalysisRemoteAsync <IList <TodoComment> >(
                document.Project.Solution,
                nameof(IRemoteTodoCommentService.GetTodoCommentsAsync),
                new object[] { document.Id, commentDescriptors }, cancellationToken).ConfigureAwait(false);

            return(result ?? SpecializedCollections.EmptyList <TodoComment>());
        }
Exemple #3
0
        private async Task <ImmutableArray <INavigateToSearchResult> > SearchProjectInRemoteProcessAsync(
            RemoteHostClient client, Project project, string searchPattern, CancellationToken cancellationToken)
        {
            var solution = project.Solution;

            var serializableResults = await client.TryRunCodeAnalysisRemoteAsync <ImmutableArray <SerializableNavigateToSearchResult> >(
                solution, nameof(IRemoteNavigateToSearchService.SearchProjectAsync),
                new object[] { project.Id, searchPattern }, cancellationToken).ConfigureAwait(false);

            return(serializableResults.NullToEmpty().SelectAsArray(r => r.Rehydrate(solution)));
        }
        private async Task <ImmutableArray <INavigateToSearchResult> > SearchProjectInRemoteProcessAsync(
            RemoteHostClient client, Project project, ImmutableArray <Document> priorityDocuments, string searchPattern, IImmutableSet <string> kinds, CancellationToken cancellationToken)
        {
            var solution = project.Solution;

            var serializableResults = await client.TryRunCodeAnalysisRemoteAsync <IList <SerializableNavigateToSearchResult> >(
                solution, nameof(IRemoteNavigateToSearchService.SearchProjectAsync),
                new object[] { project.Id, priorityDocuments.Select(d => d.Id).ToArray(), searchPattern, kinds.ToArray() }, cancellationToken).ConfigureAwait(false);

            return(serializableResults.SelectAsArray(r => r.Rehydrate(solution)));
        }
            private async Task FireAndForgetReportAnalyzerPerformanceAsync(Project project, RemoteHostClient client, AnalysisResult analysisResult, CancellationToken cancellationToken)
            {
                if (client == null)
                {
                    return;
                }

                try
                {
                    await client.TryRunCodeAnalysisRemoteAsync(
                        nameof(IRemoteDiagnosticAnalyzerService.ReportAnalyzerPerformance),
                        new object[]
                    {
                        analysisResult.AnalyzerTelemetryInfo.ToAnalyzerPerformanceInfo(_owner),
                        // +1 for project itself
                        project.DocumentIds.Count + 1
                    },
                        cancellationToken).ConfigureAwait(false);
                }
                catch (Exception ex) when(FatalError.ReportWithoutCrashUnlessCanceled(ex))
                {
                    // ignore all, this is fire and forget method
                }
            }