Skip to content

Commit

Permalink
Use MessagePack for serialization, move services to IServiceBroker (#…
Browse files Browse the repository at this point in the history
…47461)

* Use MessagePack for ISB serialization

* DocumentHighlighting service

* Renamer, EncapsulateField, TupleToStruct services

* SymbolFinder and FindUsages services

* NavigateToSearch service

* FindUsages, References fixes

* AddImport service

* SymbolSearchUpdate service

* ExtensionMethodImportCompletion service

* DependentTypeFinder service

* GlobalNotificationDelivery service

* CodeLensReferences service

* Remove CodeAnalysis service

* Remove unused code

* Fix warnings.

* Remove unused

* Error reporting and logging

* Update StreamJsonRpc to 2.6.86-alpha

* Improve callback error handling.

* Update Watson reporting

* PR feedback

* Fix tests

* Fixes

* Remove unused field

* Rename shutdown service

* Switch diagnostic serialization from ObjectReader/Writer serializer to MessagePack

* Fix diagnostic reporting issue in ASP.NET apps
  • Loading branch information
tmat authored Sep 19, 2020
1 parent 5467491 commit e91ccb5
Show file tree
Hide file tree
Showing 212 changed files with 6,226 additions and 3,356 deletions.
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
<MicrosoftVisualStudioTextManagerInterop120Version>12.0.30110</MicrosoftVisualStudioTextManagerInterop120Version>
<MicrosoftVisualStudioTextManagerInterop121DesignTimeVersion>12.1.30328</MicrosoftVisualStudioTextManagerInterop121DesignTimeVersion>
<MicrosoftVisualStudioTextManagerInterop160DesignTimeVersion>16.0.0</MicrosoftVisualStudioTextManagerInterop160DesignTimeVersion>
<MicrosoftVisualStudioThreadingAnalyzersVersion>16.7.53</MicrosoftVisualStudioThreadingAnalyzersVersion>
<MicrosoftVisualStudioThreadingVersion>16.6.13</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioThreadingAnalyzersVersion>16.7.54</MicrosoftVisualStudioThreadingAnalyzersVersion>
<MicrosoftVisualStudioThreadingVersion>16.7.54</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioUtilitiesVersion>16.6.29925.50</MicrosoftVisualStudioUtilitiesVersion>
<MicrosoftVisualStudioValidationVersion>15.5.31</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioVsInteractiveWindowVersion>2.8.0</MicrosoftVisualStudioVsInteractiveWindowVersion>
Expand Down Expand Up @@ -246,7 +246,7 @@
create a test insertion in Visual Studio to validate.
-->
<NewtonsoftJsonVersion>12.0.2</NewtonsoftJsonVersion>
<StreamJsonRpcVersion>2.6.21-alpha</StreamJsonRpcVersion>
<StreamJsonRpcVersion>2.6.86-alpha</StreamJsonRpcVersion>
<SystemCollectionsImmutableVersion>5.0.0-preview.8.20407.11</SystemCollectionsImmutableVersion>
<SystemReflectionMetadataVersion>5.0.0-preview.8.20407.11</SystemReflectionMetadataVersion>
<MicrosoftBclAsyncInterfacesVersion>1.1.1</MicrosoftBclAsyncInterfacesVersion>
Expand Down
19 changes: 15 additions & 4 deletions eng/targets/Services.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@
Note that brokered services must be defined in Microsoft.VisualStudio service namespace in order to be considered first party.
-->
<ItemGroup>
<ServiceHubService Include="roslynCodeAnalysis" ClassName="Microsoft.CodeAnalysis.Remote.CodeAnalysisService" />
<ServiceHubService Include="roslynRemoteHost" ClassName="Microsoft.CodeAnalysis.Remote.RemoteHostService" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.DiagnosticAnalyzer" ClassName="Microsoft.CodeAnalysis.Remote.RemoteDiagnosticAnalyzerService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.SemanticClassification" ClassName="Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.SemanticClassificationCache" ClassName="Microsoft.CodeAnalysis.Remote.RemoteSemanticClassificationCacheService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.DesignerAttribute" ClassName="Microsoft.CodeAnalysis.Remote.RemoteDesignerAttributeService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.DocumentHighlights" ClassName="Microsoft.CodeAnalysis.Remote.RemoteDocumentHighlightsService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.EncapsulateField" ClassName="Microsoft.CodeAnalysis.Remote.RemoteEncapsulateFieldService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.Renamer" ClassName="Microsoft.CodeAnalysis.Remote.RemoteRenamerService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.ConvertTupleToStructCodeRefactoring" ClassName="Microsoft.CodeAnalysis.Remote.RemoteConvertTupleToStructCodeRefactoringService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.SymbolFinder" ClassName="Microsoft.CodeAnalysis.Remote.RemoteSymbolFinderService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.FindUsages" ClassName="Microsoft.CodeAnalysis.Remote.RemoteFindUsagesService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.NavigateToSearch" ClassName="Microsoft.CodeAnalysis.Remote.RemoteNavigateToSearchService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.MissingImportDiscovery" ClassName="Microsoft.CodeAnalysis.Remote.RemoteMissingImportDiscoveryService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.ExtensionMethodImportCompletion" ClassName="Microsoft.CodeAnalysis.Remote.RemoteExtensionMethodImportCompletionService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.DependentTypeFinder" ClassName="Microsoft.CodeAnalysis.Remote.RemoteDependentTypeFinderService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.GlobalNotificationDelivery" ClassName="Microsoft.CodeAnalysis.Remote.RemoteGlobalNotificationDeliveryService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.CodeLensReferences" ClassName="Microsoft.CodeAnalysis.Remote.RemoteCodeLensReferencesService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.DesignerAttributeDiscovery" ClassName="Microsoft.CodeAnalysis.Remote.RemoteDesignerAttributeDiscoveryService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.ProjectTelemetry" ClassName="Microsoft.CodeAnalysis.Remote.RemoteProjectTelemetryService+Factory" IsBrokered="true" />
<ServiceHubService Include="roslynRemoteSymbolSearchUpdateEngine" ClassName="Microsoft.CodeAnalysis.Remote.RemoteSymbolSearchUpdateEngine" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.TodoComments" ClassName="Microsoft.CodeAnalysis.Remote.RemoteTodoCommentsService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.SymbolSearchUpdate" ClassName="Microsoft.CodeAnalysis.Remote.RemoteSymbolSearchUpdateService+Factory" IsBrokered="true" />
<ServiceHubService Include="Microsoft.VisualStudio.LanguageServices.TodoCommentsDiscovery" ClassName="Microsoft.CodeAnalysis.Remote.RemoteTodoCommentsDiscoveryService+Factory" IsBrokered="true" />
<ServiceHubService Include="roslynLanguageServer" ClassName="Microsoft.CodeAnalysis.Remote.LanguageServer" />
</ItemGroup>

Expand Down
58 changes: 40 additions & 18 deletions src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerTelemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,114 +5,136 @@
#nullable enable

using System;
using System.Runtime.Serialization;

namespace Microsoft.CodeAnalysis.Diagnostics.Telemetry
{
/// <summary>
/// Contains telemetry info for a specific analyzer, such as count of registered actions, the total execution time, etc.
/// </summary>
[DataContract]
public sealed class AnalyzerTelemetryInfo
{
/// <summary>
/// Count of registered compilation start actions.
/// </summary>
public int CompilationStartActionsCount { get; set; } = 0;
[DataMember(Order = 0)]
public int CompilationStartActionsCount { get; set; }

/// <summary>
/// Count of registered compilation end actions.
/// </summary>
public int CompilationEndActionsCount { get; set; } = 0;
[DataMember(Order = 1)]
public int CompilationEndActionsCount { get; set; }

/// <summary>
/// Count of registered compilation actions.
/// </summary>
public int CompilationActionsCount { get; set; } = 0;
[DataMember(Order = 2)]
public int CompilationActionsCount { get; set; }

/// <summary>
/// Count of registered syntax tree actions.
/// </summary>
public int SyntaxTreeActionsCount { get; set; } = 0;
[DataMember(Order = 3)]
public int SyntaxTreeActionsCount { get; set; }

/// <summary>
/// Count of registered additional file actions.
/// </summary>
public int AdditionalFileActionsCount { get; set; } = 0;
[DataMember(Order = 4)]
public int AdditionalFileActionsCount { get; set; }

/// <summary>
/// Count of registered semantic model actions.
/// </summary>
public int SemanticModelActionsCount { get; set; } = 0;
[DataMember(Order = 5)]
public int SemanticModelActionsCount { get; set; }

/// <summary>
/// Count of registered symbol actions.
/// </summary>
public int SymbolActionsCount { get; set; } = 0;
[DataMember(Order = 6)]
public int SymbolActionsCount { get; set; }

/// <summary>
/// Count of registered symbol start actions.
/// </summary>
public int SymbolStartActionsCount { get; set; } = 0;
[DataMember(Order = 7)]
public int SymbolStartActionsCount { get; set; }

/// <summary>
/// Count of registered symbol end actions.
/// </summary>
public int SymbolEndActionsCount { get; set; } = 0;
[DataMember(Order = 8)]
public int SymbolEndActionsCount { get; set; }

/// <summary>
/// Count of registered syntax node actions.
/// </summary>
public int SyntaxNodeActionsCount { get; set; } = 0;
[DataMember(Order = 9)]
public int SyntaxNodeActionsCount { get; set; }

/// <summary>
/// Count of registered code block start actions.
/// </summary>
public int CodeBlockStartActionsCount { get; set; } = 0;
[DataMember(Order = 10)]
public int CodeBlockStartActionsCount { get; set; }

/// <summary>
/// Count of registered code block end actions.
/// </summary>
public int CodeBlockEndActionsCount { get; set; } = 0;
[DataMember(Order = 11)]
public int CodeBlockEndActionsCount { get; set; }

/// <summary>
/// Count of registered code block actions.
/// </summary>
public int CodeBlockActionsCount { get; set; } = 0;
[DataMember(Order = 12)]
public int CodeBlockActionsCount { get; set; }

/// <summary>
/// Count of registered operation actions.
/// </summary>
public int OperationActionsCount { get; set; } = 0;
[DataMember(Order = 13)]
public int OperationActionsCount { get; set; }

/// <summary>
/// Count of registered operation block start actions.
/// </summary>
public int OperationBlockStartActionsCount { get; set; } = 0;
[DataMember(Order = 14)]
public int OperationBlockStartActionsCount { get; set; }

/// <summary>
/// Count of registered operation block end actions.
/// </summary>
public int OperationBlockEndActionsCount { get; set; } = 0;
[DataMember(Order = 15)]
public int OperationBlockEndActionsCount { get; set; }

/// <summary>
/// Count of registered operation block actions.
/// </summary>
public int OperationBlockActionsCount { get; set; } = 0;
[DataMember(Order = 16)]
public int OperationBlockActionsCount { get; set; }

/// <summary>
/// Count of registered suppression actions.
/// This is the same as count of <see cref="DiagnosticSuppressor"/>s as each suppressor
/// has a single suppression action, i.e. <see cref="DiagnosticSuppressor.ReportSuppressions(SuppressionAnalysisContext)"/>.
/// </summary>
public int SuppressionActionsCount { get; set; } = 0;
[DataMember(Order = 17)]
public int SuppressionActionsCount { get; set; }

/// <summary>
/// Total execution time.
/// </summary>
[DataMember(Order = 18)]
public TimeSpan ExecutionTime { get; set; } = TimeSpan.Zero;

/// <summary>
/// Gets a value indicating whether the analyzer supports concurrent execution.
/// </summary>
[DataMember(Order = 19)]
public bool Concurrent { get; set; }

internal AnalyzerTelemetryInfo(AnalyzerActionCounts actionCounts, int suppressionActionCounts, TimeSpan executionTime)
Expand Down
4 changes: 4 additions & 0 deletions src/Compilers/Core/Portable/Text/TextChange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.Serialization;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;

Expand All @@ -15,16 +16,19 @@ namespace Microsoft.CodeAnalysis.Text
/// <summary>
/// Describes a single change when a particular span is replaced with a new text.
/// </summary>
[DataContract]
public readonly struct TextChange : IEquatable<TextChange>
{
/// <summary>
/// The original span of the changed text.
/// </summary>
[DataMember(Order = 0)]
public TextSpan Span { get; }

/// <summary>
/// The new text.
/// </summary>
[DataMember(Order = 1)]
public string? NewText { get; }

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Compilers/Core/Portable/Text/TextSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#nullable enable

using System;
using System.Runtime.Serialization;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Text
Expand All @@ -13,6 +14,7 @@ namespace Microsoft.CodeAnalysis.Text
/// Immutable abstract representation of a span of text. For example, in an error diagnostic that reports a
/// location, it could come from a parsed string, text from a tool editor buffer, etc.
/// </summary>
[DataContract]
public readonly struct TextSpan : IEquatable<TextSpan>, IComparable<TextSpan>
{
/// <summary>
Expand All @@ -38,6 +40,7 @@ public TextSpan(int start, int length)
/// <summary>
/// Start point of the span.
/// </summary>
[DataMember(Order = 0)]
public int Start { get; }

/// <summary>
Expand All @@ -48,6 +51,7 @@ public TextSpan(int start, int length)
/// <summary>
/// Length of the span.
/// </summary>
[DataMember(Order = 1)]
public int Length { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ internal class CSharpFindUsagesLSPService : AbstractFindUsagesService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpFindUsagesLSPService(IThreadingContext threadingContext)
: base(threadingContext)
public CSharpFindUsagesLSPService()
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ internal class CSharpFindUsagesService : AbstractFindUsagesService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpFindUsagesService(IThreadingContext threadingContext)
: base(threadingContext)
public CSharpFindUsagesService()
{
}
}
Expand Down
Loading

0 comments on commit e91ccb5

Please sign in to comment.