From c7d6f9fab845ffd943216da465022744e7d35f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Tue, 26 Oct 2021 12:08:47 -0700 Subject: [PATCH] Fix assembly layering for .NET SDK (#57386) * Fix assembly layering for .NET SDK * Feedback * Fix --- .../EditAndContinue/ActiveStatementTests.cs | 2 +- .../ActiveStatementTrackingServiceTests.cs | 2 +- .../CSharpEditAndContinueAnalyzerTests.cs | 2 +- .../Helpers/EditAndContinueValidation.cs | 2 +- .../Helpers/EditingTestBase.cs | 2 +- .../EditAndContinue/LineEditTests.cs | 2 +- .../ActiveStatementTrackingSpan.cs | 2 +- .../Contracts/ContractWrappers.cs | 69 ++++++++ .../Contracts/ManagedHotReloadServiceImpl.cs | 34 ++++ .../EditAndContinueLanguageService.cs | 12 +- ...crosoft.CodeAnalysis.EditorFeatures.csproj | 1 + .../ActiveStatementsMapTests.cs | 2 +- ...itAndContinueDiagnosticDescriptorsTests.cs | 2 +- .../EditAndContinueWorkspaceServiceTests.cs | 3 +- .../EditSessionActiveStatementsTests.cs | 2 +- .../RemoteEditAndContinueServiceTests.cs | 3 +- .../ActiveStatementTestHelpers.cs | 2 +- .../ActiveStatementsDescription.cs | 2 +- .../DocumentAnalysisResultsDescription.cs | 2 +- .../EditAndContinueTestHelpers.cs | 2 +- .../MockEditAndContinueWorkspaceService.cs | 3 +- ...ckManagedEditAndContinueDebuggerService.cs | 3 +- .../EditAndContinue/ActiveStatementTests.vb | 2 +- .../Helpers/EditAndContinueValidation.vb | 2 +- .../Helpers/EditingTestBase.vb | 2 +- .../EditAndContinue/LineEditTests.vb | 2 +- ...VisualBasicEditAndContinueAnalyzerTests.vb | 2 +- ...rosoft.CodeAnalysis.CSharp.Features.csproj | 5 - .../AbstractEditAndContinueAnalyzer.cs | 2 +- .../EditAndContinue/ActiveStatement.cs | 2 +- .../EditAndContinue/ActiveStatementSpan.cs | 2 +- .../EditAndContinue/ActiveStatementsMap.cs | 2 +- .../EditAndContinue/ActiveStatementFlags.cs | 62 ++++++++ .../EditAndContinue/DebugSessionFlags.cs | 21 +++ .../ManagedActiveStatementDebugInfo.cs | 60 +++++++ .../ManagedActiveStatementUpdate.cs | 50 ++++++ ...anagedEditAndContinueEngineCapabilities.cs | 34 ++++ .../ManagedExceptionRegionUpdate.cs | 60 +++++++ .../EditAndContinue/ManagedInstructionId.cs | 63 ++++++++ .../EditAndContinue/ManagedMethodId.cs | 72 +++++++++ .../EditAndContinue/ManagedModuleMethodId.cs | 85 ++++++++++ .../EditAndContinue/ManagedModuleUpdate.cs | 150 ++++++++++++++++++ .../ManagedModuleUpdateStatus.cs | 33 ++++ .../EditAndContinue/SequencePointUpdates.cs | 41 +++++ .../EditAndContinue/SourceLineUpdate.cs | 54 +++++++ .../Contracts/EditAndContinue/SourceSpan.cs | 109 +++++++++++++ .../Contracts/HotReload/HotReloadResult.cs | 39 +++++ .../HotReload/IManagedHotReloadService.cs | 64 ++++++++ .../HotReload/ManagedHotReloadAvailability.cs | 35 ++++ .../ManagedHotReloadAvailabilityStatus.cs | 120 ++++++++++++++ .../HotReload/ManagedHotReloadDiagnostic.cs | 67 ++++++++ .../ManagedHotReloadDiagnosticSeverity.cs | 29 ++++ .../EditAndContinue/DebuggingSession.cs | 3 +- .../DocumentAnalysisResults.cs | 2 +- .../EditAndContinueDiagnosticDescriptors.cs | 3 +- .../EditAndContinueWorkspaceService.cs | 3 +- .../Portable/EditAndContinue/EditSession.cs | 3 +- .../EmitSolutionUpdateResults.cs | 3 +- .../Portable/EditAndContinue/Extensions.cs | 2 +- .../IEditAndContinueWorkspaceService.cs | 3 +- .../ManagedModuleUpdateStatusEx.cs | 2 +- .../EditAndContinue/PendingSolutionUpdate.cs | 2 +- .../EditAndContinue/ProjectChanges.cs | 2 +- .../Remote/DebuggerContractVersionCheck.cs | 2 +- .../Remote/IRemoteEditAndContinueService.cs | 3 +- .../Remote/RemoteDebuggingSessionProxy.cs | 2 +- .../RemoteEditAndContinueServiceProxy.cs | 3 +- .../EditAndContinue/SolutionUpdate.cs | 2 +- .../API/UnitTestingHotReloadService.cs | 3 +- .../Watch/Api/WatchHotReloadService.cs | 3 +- .../Microsoft.CodeAnalysis.Features.csproj | 7 - ...t.CodeAnalysis.VisualBasic.Features.vbproj | 4 - ...osoft.VisualStudio.LanguageServices.csproj | 1 - .../RemoteEditAndContinueService.cs | 3 +- 74 files changed, 1404 insertions(+), 84 deletions(-) create mode 100644 src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ContractWrappers.cs create mode 100644 src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ManagedHotReloadServiceImpl.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ActiveStatementFlags.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/DebugSessionFlags.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementDebugInfo.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementUpdate.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedEditAndContinueEngineCapabilities.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedExceptionRegionUpdate.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedInstructionId.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedMethodId.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleMethodId.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdate.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdateStatus.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SequencePointUpdates.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceLineUpdate.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceSpan.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/HotReloadResult.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/IManagedHotReloadService.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailability.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailabilityStatus.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnostic.cs create mode 100644 src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnosticSeverity.cs diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs index f7d1c35ff6fa6..b0b9c401a3b0b 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs @@ -7,8 +7,8 @@ using System; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTrackingServiceTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTrackingServiceTests.cs index f311d532123ae..d62eb5443f7e8 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTrackingServiceTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTrackingServiceTests.cs @@ -9,12 +9,12 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs index 7f94c58593eeb..2c81eddb94019 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/CSharpEditAndContinueAnalyzerTests.cs @@ -14,11 +14,11 @@ using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditAndContinueValidation.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditAndContinueValidation.cs index 52c058b281df5..82fc0c3d34d77 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditAndContinueValidation.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditAndContinueValidation.cs @@ -6,8 +6,8 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Xunit; diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs index a80f3fe6d4f9e..427e8c1a82ce9 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/EditingTestBase.cs @@ -10,11 +10,11 @@ using Microsoft.CodeAnalysis.CSharp.UnitTests; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Utilities; using Xunit; diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/LineEditTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/LineEditTests.cs index b635fe864d72f..583f3fc606bbd 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/LineEditTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/LineEditTests.cs @@ -9,10 +9,10 @@ using System.Linq; using Microsoft.CodeAnalysis.CSharp.UnitTests; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Xunit; diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingSpan.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingSpan.cs index d485e60804fdf..951217859ee0b 100644 --- a/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingSpan.cs +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/ActiveStatementTrackingSpan.cs @@ -3,8 +3,8 @@ // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.Text.Shared.Extensions; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Microsoft.VisualStudio.Text; namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ContractWrappers.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ContractWrappers.cs new file mode 100644 index 0000000000000..2b6af5acbbdcd --- /dev/null +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ContractWrappers.cs @@ -0,0 +1,69 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.VisualStudio.Debugger.Contracts.HotReload; + +using Contracts = Microsoft.CodeAnalysis.EditAndContinue.Contracts; + +namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue +{ + internal static class ContractWrappers + { + public static Contracts.ManagedActiveStatementDebugInfo ToContract(this ManagedActiveStatementDebugInfo info) + => new(ToContract(info.ActiveInstruction), info.DocumentName, ToContract(info.SourceSpan), (Contracts.ActiveStatementFlags)info.Flags); + + public static Contracts.ManagedInstructionId ToContract(this ManagedInstructionId id) + => new(ToContract(id.Method), id.ILOffset); + + public static Contracts.ManagedMethodId ToContract(this ManagedMethodId id) + => new(id.Module, id.Token, id.Version); + + public static Contracts.SourceSpan ToContract(this SourceSpan id) + => new(id.StartLine, id.StartColumn, id.EndLine, id.EndColumn); + + public static Contracts.ManagedHotReloadAvailability ToContract(this ManagedHotReloadAvailability value) + => new((Contracts.ManagedHotReloadAvailabilityStatus)value.Status, value.LocalizedMessage); + + public static ManagedModuleUpdates FromContract(this Contracts.ManagedModuleUpdates updates) + => new((ManagedModuleUpdateStatus)updates.Status, updates.Updates.SelectAsArray(FromContract)); + + public static ManagedModuleUpdate FromContract(this Contracts.ManagedModuleUpdate update) + => new( + update.Module, + update.ILDelta, + update.MetadataDelta, + update.PdbDelta, + update.SequencePoints.SelectAsArray(FromContract), + update.UpdatedMethods, + update.UpdatedTypes, + update.ActiveStatements.SelectAsArray(FromContract), + update.ExceptionRegions.SelectAsArray(FromContract)); + + public static SequencePointUpdates FromContract(this Contracts.SequencePointUpdates updates) + => new(updates.FileName, updates.LineUpdates.SelectAsArray(FromContract)); + + public static SourceLineUpdate FromContract(this Contracts.SourceLineUpdate update) + => new(update.OldLine, update.NewLine); + + public static ManagedActiveStatementUpdate FromContract(this Contracts.ManagedActiveStatementUpdate update) + => new(FromContract(update.Method), update.ILOffset, FromContract(update.NewSpan)); + + public static ManagedModuleMethodId FromContract(this Contracts.ManagedModuleMethodId update) + => new(update.Token, update.Version); + + public static SourceSpan FromContract(this Contracts.SourceSpan id) + => new(id.StartLine, id.StartColumn, id.EndLine, id.EndColumn); + + public static ManagedExceptionRegionUpdate FromContract(this Contracts.ManagedExceptionRegionUpdate update) + => new(FromContract(update.Method), update.Delta, FromContract(update.NewSpan)); + + public static ImmutableArray FromContract(this ImmutableArray diagnostics) + => diagnostics.SelectAsArray(FromContract); + + public static ManagedHotReloadDiagnostic FromContract(this Contracts.ManagedHotReloadDiagnostic diagnostic) + => new(diagnostic.Id, diagnostic.Message, (ManagedHotReloadDiagnosticSeverity)diagnostic.Severity, diagnostic.FilePath, FromContract(diagnostic.Span)); + } +} diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ManagedHotReloadServiceImpl.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ManagedHotReloadServiceImpl.cs new file mode 100644 index 0000000000000..6d39919ec5ddc --- /dev/null +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/Contracts/ManagedHotReloadServiceImpl.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.Debugger.Contracts.HotReload; + +using Contracts = Microsoft.CodeAnalysis.EditAndContinue.Contracts; + +namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue +{ + internal sealed class ManagedHotReloadServiceImpl : Contracts.IManagedHotReloadService + { + private readonly IManagedHotReloadService _service; + + public ManagedHotReloadServiceImpl(IManagedHotReloadService service) + => _service = service; + + public async ValueTask> GetActiveStatementsAsync(CancellationToken cancellation) + => (await _service.GetActiveStatementsAsync(cancellation).ConfigureAwait(false)).SelectAsArray(a => a.ToContract()); + + public async ValueTask GetAvailabilityAsync(Guid module, CancellationToken cancellation) + => (await _service.GetAvailabilityAsync(module, cancellation).ConfigureAwait(false)).ToContract(); + + public ValueTask> GetCapabilitiesAsync(CancellationToken cancellation) + => _service.GetCapabilitiesAsync(cancellation); + + public ValueTask PrepareModuleForUpdateAsync(Guid module, CancellationToken cancellation) + => _service.PrepareModuleForUpdateAsync(module, cancellation); + } +} diff --git a/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueLanguageService.cs b/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueLanguageService.cs index d95f3ac3774bf..bab37ec4f33eb 100644 --- a/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueLanguageService.cs +++ b/src/EditorFeatures/Core/Implementation/EditAndContinue/EditAndContinueLanguageService.cs @@ -100,7 +100,7 @@ public async ValueTask StartSessionAsync(CancellationToken cancellationToken) _debuggingSession = await proxy.StartDebuggingSessionAsync( solution, - _debuggerService.Value, + new ManagedHotReloadServiceImpl(_debuggerService.Value), captureMatchingDocuments: openedDocumentIds, captureAllMatchingDocuments: false, reportDiagnostics: true, @@ -278,7 +278,7 @@ public async ValueTask GetEditAndContinueUpdatesAsync(Canc var activeStatementSpanProvider = GetActiveStatementSpanProvider(solution); var (updates, _, _, _) = await GetDebuggingSession().EmitSolutionUpdateAsync(solution, activeStatementSpanProvider, _diagnosticService, _diagnosticUpdateSource, cancellationToken).ConfigureAwait(false); _pendingUpdatedSolution = solution; - return updates; + return updates.FromContract(); } public async ValueTask GetHotReloadUpdatesAsync(CancellationToken cancellationToken) @@ -297,7 +297,7 @@ public async ValueTask GetHotReloadUpdatesAsync(Cancell var diagnostics = await EmitSolutionUpdateResults.GetHotReloadDiagnosticsAsync(solution, diagnosticData, rudeEdits, syntaxError, cancellationToken).ConfigureAwait(false); - return new ManagedHotReloadUpdates(updates, diagnostics); + return new ManagedHotReloadUpdates(updates, diagnostics.FromContract()); } public async ValueTask GetCurrentActiveStatementPositionAsync(ManagedInstructionId instruction, CancellationToken cancellationToken) @@ -310,8 +310,8 @@ public async ValueTask GetHotReloadUpdatesAsync(Cancell var activeStatementSpanProvider = new ActiveStatementSpanProvider((documentId, filePath, cancellationToken) => activeStatementTrackingService.GetSpansAsync(solution, documentId, filePath, cancellationToken)); - var span = await GetDebuggingSession().GetCurrentActiveStatementPositionAsync(solution, activeStatementSpanProvider, instruction, cancellationToken).ConfigureAwait(false); - return span?.ToSourceSpan(); + var span = await GetDebuggingSession().GetCurrentActiveStatementPositionAsync(solution, activeStatementSpanProvider, instruction.ToContract(), cancellationToken).ConfigureAwait(false); + return span?.ToSourceSpan().FromContract(); } catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e, cancellationToken)) { @@ -324,7 +324,7 @@ public async ValueTask GetHotReloadUpdatesAsync(Cancell try { var solution = GetCurrentCompileTimeSolution(); - return await GetDebuggingSession().IsActiveStatementInExceptionRegionAsync(solution, instruction, cancellationToken).ConfigureAwait(false); + return await GetDebuggingSession().IsActiveStatementInExceptionRegionAsync(solution, instruction.ToContract(), cancellationToken).ConfigureAwait(false); } catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e, cancellationToken)) { diff --git a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj index 53f40799cd231..d09eef43f78e2 100644 --- a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj +++ b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj @@ -39,6 +39,7 @@ + diff --git a/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs b/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs index af4fa77d7a52d..658e0bb4a230c 100644 --- a/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs @@ -9,10 +9,10 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Xunit; diff --git a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticDescriptorsTests.cs b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticDescriptorsTests.cs index c32ff8f7c5e75..c60dacb221afc 100644 --- a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticDescriptorsTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueDiagnosticDescriptorsTests.cs @@ -7,7 +7,7 @@ using System.Linq; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Xunit; namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests diff --git a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.cs b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.cs index d7a7e8a03d9ca..91fb4eb2985a9 100644 --- a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueWorkspaceServiceTests.cs @@ -19,6 +19,7 @@ using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Debugging; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api; @@ -26,8 +27,6 @@ using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.UnitTests; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Roslyn.Test.Utilities.TestGenerators; using Roslyn.Utilities; diff --git a/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs b/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs index 2c143e95bafe7..97cbfe86a4262 100644 --- a/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs @@ -11,6 +11,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.Editor.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Emit; @@ -19,7 +20,6 @@ using Moq; using Roslyn.Test.Utilities; using Roslyn.Utilities; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Xunit; using System.Text; using System.IO; diff --git a/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs b/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs index fdd5710354368..019c7f3c0fd7c 100644 --- a/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; @@ -25,8 +26,6 @@ using Microsoft.CodeAnalysis.Remote.Testing; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementTestHelpers.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementTestHelpers.cs index 0f99facf7e053..6994052203229 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementTestHelpers.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementTestHelpers.cs @@ -8,7 +8,7 @@ using System.Linq; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.CSharp; namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs index 6ef05c194cf7f..6b0f5c65a9fda 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs @@ -9,10 +9,10 @@ using System.Linq; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Roslyn.Utilities; diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/DocumentAnalysisResultsDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/DocumentAnalysisResultsDescription.cs index 549ee0fd6b8bc..8328bf5ac80cf 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/DocumentAnalysisResultsDescription.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/DocumentAnalysisResultsDescription.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Immutable; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests { diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs index 241be2f1e1d07..f8ff7ad4052c4 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs @@ -9,11 +9,11 @@ using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.Differencing; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/MockEditAndContinueWorkspaceService.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/MockEditAndContinueWorkspaceService.cs index 9fc6b134a1bdc..cdc8be2c7ed47 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/MockEditAndContinueWorkspaceService.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/MockEditAndContinueWorkspaceService.cs @@ -9,8 +9,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests { diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/MockManagedEditAndContinueDebuggerService.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/MockManagedEditAndContinueDebuggerService.cs index 21b4cbbc468e6..c1389193300a6 100644 --- a/src/EditorFeatures/TestUtilities/EditAndContinue/MockManagedEditAndContinueDebuggerService.cs +++ b/src/EditorFeatures/TestUtilities/EditAndContinue/MockManagedEditAndContinueDebuggerService.cs @@ -7,8 +7,7 @@ using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb index b6bce15afc2d5..e12af898d45eb 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb @@ -4,7 +4,7 @@ Imports Microsoft.CodeAnalysis.EditAndContinue Imports Microsoft.CodeAnalysis.Emit -Imports Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue +Imports Microsoft.CodeAnalysis.EditAndContinue.Contracts Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb index c540b86ec0dd5..834e63b6b85d0 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditAndContinueValidation.vb @@ -6,9 +6,9 @@ Imports System.Collections.Immutable Imports System.Runtime.CompilerServices Imports Microsoft.CodeAnalysis.Differencing Imports Microsoft.CodeAnalysis.EditAndContinue +Imports Microsoft.CodeAnalysis.EditAndContinue.Contracts Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EditAndContinue -Imports Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb index eb728104e3244..cb3cfbd36b220 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/EditingTestBase.vb @@ -5,6 +5,7 @@ Imports System.Collections.Immutable Imports Microsoft.CodeAnalysis.Differencing Imports Microsoft.CodeAnalysis.EditAndContinue +Imports Microsoft.CodeAnalysis.EditAndContinue.Contracts Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EditAndContinue Imports Microsoft.CodeAnalysis.Emit @@ -12,7 +13,6 @@ Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax -Imports Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/LineEditTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/LineEditTests.vb index a9a9802c6fde8..f9ce4e1dedf6c 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/LineEditTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/LineEditTests.vb @@ -5,10 +5,10 @@ Imports System.Collections.Immutable Imports System.Xml.Linq Imports Microsoft.CodeAnalysis.EditAndContinue +Imports Microsoft.CodeAnalysis.EditAndContinue.Contracts Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.Emit Imports Microsoft.CodeAnalysis.VisualBasic.Symbols -Imports Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb index ec277475dd02b..0346d944b7f78 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/VisualBasicEditAndContinueAnalyzerTests.vb @@ -6,11 +6,11 @@ Imports System.Collections.Immutable Imports System.Threading Imports Microsoft.CodeAnalysis.Differencing Imports Microsoft.CodeAnalysis.EditAndContinue +Imports Microsoft.CodeAnalysis.EditAndContinue.Contracts Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.Editor.UnitTests Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Text -Imports Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests diff --git a/src/Features/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj b/src/Features/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj index 6e1cf3b12e7b1..a82a820316c48 100644 --- a/src/Features/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj +++ b/src/Features/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.Features.csproj @@ -60,11 +60,6 @@ InternalUtilities\LambdaUtilities.cs - - - - - diff --git a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs index dcfa1e097ee29..320b1ef6b48f1 100644 --- a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs +++ b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs @@ -20,7 +20,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs index 28862a59e5122..3cb2aed896a1f 100644 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatement.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs index 20ea172eacea9..adc60d37ebae5 100644 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementSpan.cs @@ -8,7 +8,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs b/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs index d1bae72dc88c7..2297e638bcec4 100644 --- a/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs +++ b/src/Features/Core/Portable/EditAndContinue/ActiveStatementsMap.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ActiveStatementFlags.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ActiveStatementFlags.cs new file mode 100644 index 0000000000000..a7aca6c26bdbc --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ActiveStatementFlags.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Flags regarding active statements information. + /// + [Flags] + internal enum ActiveStatementFlags + { + None = 0, + + /// + /// At least one of the threads whom this active statement belongs to is in a leaf frame. + /// + LeafFrame = 1, + + /// + /// The statement is partially executed. + /// + /// + /// An active statement is partially executed if the thread is stopped in between two sequence points. + /// This may happen when the users steps through the code in disassembly window (stepping over machine instructions), + /// when the compiler emits a call to Debugger.Break (VB Stop statement), etc. + /// + /// Partially executed active statement can't be edited. + /// + PartiallyExecuted = 2, + + /// + /// The statement IL is not in user code. + /// + NonUserCode = 4, + + /// + /// Indicates that the active statement instruction belongs to the latest version of the containing method. + /// If not set, the containing method was updated but the active statement was not remapped yet because the thread + /// has not returned to that instruction yet and was not remapped to the new version. + /// + /// + /// When the debugger asks the CLR for the active statement information it compares ICorDebugFunction.GetVersionNumber() + /// and ICorDebugFunction.GetCurrentVersionNumber() to determine the value of this flag. + /// + MethodUpToDate = 8, + + /// + /// At least one of the threads whom this active statement belongs to is in a non-leaf frame. + /// + NonLeafFrame = 16, + + /// + /// When applying updates while the code is executing, we will not attempt any remap for methods which are on the + /// executing stack. This is done so we can avoid blocking an edit due an executing active statement. + /// Language services needs to acknowledge such active statements when emitting further remap information. + /// + Stale = 32 + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/DebugSessionFlags.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/DebugSessionFlags.cs new file mode 100644 index 0000000000000..fe4d430fb6ff9 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/DebugSessionFlags.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +using System; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + [Flags] + internal enum DebugSessionFlags + { + /// + /// No flags. + /// + None = 0, + + /// + /// Edit and Continue has been disabled by the client. + /// + EditAndContinueDisabled = 0x1, + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementDebugInfo.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementDebugInfo.cs new file mode 100644 index 0000000000000..7f2e0ea6095c3 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementDebugInfo.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +using System.Runtime.Serialization; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Active statement debug information retrieved from the runtime and the PDB. + /// + [DataContract] + internal readonly struct ManagedActiveStatementDebugInfo + { + /// + /// Creates a ManagedActiveStatementDebugInfo. + /// + /// Instruction of the active statement that is being executed. + /// Document name as found in the PDB, if the active statement location was determined. + /// Location of the closest non-hidden sequence point from the active statement. + /// Active statement flags shared across all threads that own the active statement. + public ManagedActiveStatementDebugInfo( + ManagedInstructionId activeInstruction, + string? documentName, + SourceSpan sourceSpan, + ActiveStatementFlags flags) + { + ActiveInstruction = activeInstruction; + DocumentName = documentName; + SourceSpan = sourceSpan; + Flags = flags; + } + + /// + /// The instruction of the active statement that is being executed. + /// + [DataMember(Name = "activeInstruction")] + public ManagedInstructionId ActiveInstruction { get; } + + /// + /// Document name as found in the PDB, or null if the debugger can't determine the location of the active statement. + /// + [DataMember(Name = "documentName")] + public string? DocumentName { get; } + + /// + /// Location of the closest non-hidden sequence point retrieved from the PDB, + /// or default() if the debugger can't determine the location of the active statement. + /// + [DataMember(Name = "sourceSpan")] + public SourceSpan SourceSpan { get; } + + /// + /// Aggregated across any threads that own the active instruction. + /// + [DataMember(Name = "flags")] + public ActiveStatementFlags Flags { get; } + + public bool HasSourceLocation => DocumentName != null; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementUpdate.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementUpdate.cs new file mode 100644 index 0000000000000..c6e579a853740 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedActiveStatementUpdate.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +using System.Runtime.Serialization; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Active statement affected by a managed update. + /// This is used when remapping the instruction pointer to the appropriate location. + /// + [DataContract] + internal readonly struct ManagedActiveStatementUpdate + { + /// + /// Creates a ManagedActiveStatementUpdate. + /// + /// Method information before the change was made. + /// Old IL offset of the active statement. + /// Updated text span for the active statement. + public ManagedActiveStatementUpdate( + ManagedModuleMethodId method, + int ilOffset, + SourceSpan newSpan) + { + Method = method; + ILOffset = ilOffset; + NewSpan = newSpan; + } + + /// + /// Method ID. It has the token for the method that contains the active statement + /// and the version when the change was made. + /// + [DataMember(Name = "method")] + public ManagedModuleMethodId Method { get; } + + /// + /// Old IL offset for the active statement. + /// + [DataMember(Name = "ilOffset")] + public int ILOffset { get; } + + /// + /// Updated text span for the active statement after the edit was made. + /// + [DataMember(Name = "newSpan")] + public SourceSpan NewSpan { get; } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedEditAndContinueEngineCapabilities.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedEditAndContinueEngineCapabilities.cs new file mode 100644 index 0000000000000..48f8734211962 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedEditAndContinueEngineCapabilities.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +using System; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Flags regarding Edit and Continue engine capabilities. + /// + [Flags] + internal enum ManagedEditAndContinueEngineCapabilities + { + /// + /// No flags. + /// + None = 0, + + /// + /// Whether we can replace methods while stopped. + /// + CanReplaceMethodsWhileStopped = 0x1, + + /// + /// Whether the engine supports changes made in the current method. + /// + SupportsInMethodReplacements = 0x2, + + /// + /// Whether it supports applying changes once a module has been loaded. + /// + SupportsEditAndContinueOnModuleLoad = 0x4 + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedExceptionRegionUpdate.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedExceptionRegionUpdate.cs new file mode 100644 index 0000000000000..ecb1c986c0483 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedExceptionRegionUpdate.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +using System.Runtime.Serialization; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Exception region affected by a managed update. + /// + [DataContract] + internal readonly struct ManagedExceptionRegionUpdate + { + /// + /// Creates an ExceptionRegionUpdate. + /// + /// Method information before the change was made. + /// Total of lines modified after the update. + /// Updated text span for the active statement. + public ManagedExceptionRegionUpdate( + ManagedModuleMethodId method, + int delta, + SourceSpan newSpan) + { + Method = method; + Delta = delta; + NewSpan = newSpan; + } + + /// + /// Method ID. It has the token for the method that contains the exception region + /// and the version when the change was made. + /// + [DataMember(Name = "method")] + public ManagedModuleMethodId Method { get; } + + /// + /// The delta is the total of lines modified after the update. This value is inverse: + /// + /// OldSpan = NewSpan + Delta + /// NewSpan = OldSpan - Delta + /// + /// For example, if 2 new lines were added preceding the exception region, this value will be -2. + /// + [DataMember(Name = "delta")] + public int Delta { get; } + + /// + /// Specifies where the exception region starts and ends after the update. This value is 0-based. + /// An exception region value generally corresponds to a catch { } block source span before any update is made. + /// + /// + /// This value will take into account any lines affected by the update, so we can correctly track the new exception regions + /// when remapping the instruction pointer. + /// The new span is expected to be: [PreviousExceptionRegionSpan] + [Delta of updated lines]. + /// + [DataMember(Name = "newSpan")] + public SourceSpan NewSpan { get; } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedInstructionId.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedInstructionId.cs new file mode 100644 index 0000000000000..632b8e5bf3641 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedInstructionId.cs @@ -0,0 +1,63 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Active instruction identifier. + /// It has the information necessary to track an active instruction within the debug session. + /// + [DataContract] + [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] + internal readonly struct ManagedInstructionId : IEquatable + { + /// + /// Creates an ActiveInstructionId. + /// + /// Method which the instruction is scoped to. + /// IL offset for the instruction. + public ManagedInstructionId( + ManagedMethodId method, + int ilOffset) + { + Method = method; + ILOffset = ilOffset; + } + + /// + /// Method which the instruction is scoped to. + /// + [DataMember(Name = "method")] + public ManagedMethodId Method { get; } + + /// + /// The IL offset for the instruction. + /// + [DataMember(Name = "ilOffset")] + public int ILOffset { get; } + + public bool Equals(ManagedInstructionId other) + { + return Method.Equals(other.Method) && ILOffset == other.ILOffset; + } + + public override bool Equals(object? obj) => obj is ManagedInstructionId instr && Equals(instr); + + public override int GetHashCode() + { + return Method.GetHashCode() ^ ILOffset; + } + + public static bool operator ==(ManagedInstructionId left, ManagedInstructionId right) => left.Equals(right); + + public static bool operator !=(ManagedInstructionId left, ManagedInstructionId right) => !(left == right); + + internal string GetDebuggerDisplay() => $"{Method.GetDebuggerDisplay()} IL_{ILOffset:X4}"; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedMethodId.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedMethodId.cs new file mode 100644 index 0000000000000..96b0aa399fccf --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedMethodId.cs @@ -0,0 +1,72 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// ManagedMethodId is a module/method pair which is used to uniquely identify the + /// symbol store's understanding of a particular CLR method. + /// + [DataContract] + [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] + internal readonly struct ManagedMethodId : IEquatable + { + /// + /// Creates a ManagedMethodId. + /// + /// Module version ID in which the method exists. + /// Method ID. + public ManagedMethodId( + Guid module, + ManagedModuleMethodId method) + { + Module = module; + Method = method; + } + + public ManagedMethodId(Guid module, int token, int version) + : this(module, new(token, version)) + { + } + + /// + /// The module version ID in which the method exists. + /// + [DataMember(Name = "module")] + public Guid Module { get; } + + /// + /// The unique identifier for the method within . + /// + [DataMember(Name = "method")] + public ManagedModuleMethodId Method { get; } + + public int Token => Method.Token; + + public int Version => Method.Version; + + public bool Equals(ManagedMethodId other) + { + return Module == other.Module && Method.Equals(other.Method); + } + + public override bool Equals(object? obj) => obj is ManagedMethodId method && Equals(method); + + public override int GetHashCode() + { + return Module.GetHashCode() ^ Method.GetHashCode(); + } + + public static bool operator ==(ManagedMethodId left, ManagedMethodId right) => left.Equals(right); + + public static bool operator !=(ManagedMethodId left, ManagedMethodId right) => !(left == right); + + internal string GetDebuggerDisplay() => $"mvid={Module} {Method.GetDebuggerDisplay()}"; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleMethodId.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleMethodId.cs new file mode 100644 index 0000000000000..7c5704a263371 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleMethodId.cs @@ -0,0 +1,85 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// ManagedModuleMethodId is a token/version pair which is used to uniquely identify the + /// symbol store's understanding of a particular CLR method within a module context. + /// See for more details. + /// + [DataContract] + [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] + internal readonly struct ManagedModuleMethodId : IEquatable + { + /// + /// Creates a ManagedModuleMethodId. + /// + /// Method token. + /// Method version. + /// + /// If is less or equals 0x06000000 or is less or equals zero. + /// + public ManagedModuleMethodId( + int token, + int version) + { + // 0x06 means that the token is for a MethodDef. + // Valid method tokens are expected to be greather than 0x06000000. + if (token <= 0x06000000) + throw new ArgumentOutOfRangeException(nameof(token)); + if (version <= 0) + throw new ArgumentOutOfRangeException(nameof(version)); + + Token = token; + Version = version; + } + + /// + /// The method definition metadata token of the method that contains this symbol. + /// + [DataMember(Name = "token")] + public int Token { get; } + + /// + /// MethodVersion is a 1-based index. This will be '1' for methods that have not + /// been edited through Edit-and-continue. For edited methods, the version indicates + /// the EnC apply of this method. + /// Thus, if the user does 5 EnC applies and a particular method is only edited in the 5th apply, + /// then there are two method ids for this method, and they have Version = 1 and Version = 5. + /// + /// The debugger needs to deal with old versions of the method because they will + /// continue to be on the call stack until control is unwound.The debugger can also hit + /// breakpoints or stop for exceptions within exception handling regions of old + /// methods. In other words, if the user sets a breakpoint within the catch block of a + /// non-leaf method, the debugger needs to set that breakpoint within the old version + /// of the method. + /// + /// In scenarios such as function breakpoint binding, the value '0' may used to + /// indicate the current version of the method. + /// + [DataMember(Name = "version")] + public int Version { get; } + + public bool Equals(ManagedModuleMethodId other) + { + return Token == other.Token && Version == other.Version; + } + + public override bool Equals(object? obj) => obj is ManagedModuleMethodId method && Equals(method); + + public override int GetHashCode() => Token ^ Version; + + public static bool operator ==(ManagedModuleMethodId left, ManagedModuleMethodId right) => left.Equals(right); + + public static bool operator !=(ManagedModuleMethodId left, ManagedModuleMethodId right) => !(left == right); + + internal string GetDebuggerDisplay() => $"0x{Token:X8} v{Version}"; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdate.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdate.cs new file mode 100644 index 0000000000000..88b62fbaf5946 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdate.cs @@ -0,0 +1,150 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using System; +using System.Collections.Immutable; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Information about a collection of managed updates under a target module. + /// + [DataContract] + internal readonly struct ManagedModuleUpdates + { + /// + /// Creates a new ManagedModuleUpdates. + /// + /// Update status. + /// Collection of the module updates. + public ManagedModuleUpdates( + ManagedModuleUpdateStatus status, + ImmutableArray updates) + { + Status = status; + Updates = updates; + } + + /// + /// This is the kind of change made to the modules owned by the provider. + /// The change is aggregated across all modules owned by the provider: if one module has a rude edit + /// and another one has valid change, the resulting kind is . + /// If is empty, this has a value of . + /// + [DataMember(Name = "status")] + public ManagedModuleUpdateStatus Status { get; } + + /// + /// Expected to be empty if Status != Ready. + /// + [DataMember(Name = "updates")] + public ImmutableArray Updates { get; } + } + + /// + /// Information about a single update. This corresponds to an edit made by the user. + /// + [DataContract] + internal readonly struct ManagedModuleUpdate + { + /// + /// Creates a new ManagedModuleUpdate. + /// + /// Module ID which the update belongs to. + /// IL delta from the change. + /// Metadata delta from the change. + /// PDB delta from the change. + /// Sequence points affected by the symbolic data change. + /// Methods affected by the update. + /// Active statements affected by the update. + /// Exception regions affected by the update. + /// List of updated TypeDefs. + public ManagedModuleUpdate( + Guid module, + ImmutableArray ilDelta, + ImmutableArray metadataDelta, + ImmutableArray pdbDelta, + ImmutableArray sequencePoints, + ImmutableArray updatedMethods, + ImmutableArray updatedTypes, + ImmutableArray activeStatements, + ImmutableArray exceptionRegions) + { + Module = module; + + ILDelta = ilDelta; + MetadataDelta = metadataDelta; + + PdbDelta = pdbDelta; + SequencePoints = sequencePoints; + + UpdatedMethods = updatedMethods; + UpdatedTypes = updatedTypes; + + ActiveStatements = activeStatements; + ExceptionRegions = exceptionRegions; + } + + /// + /// Module version Identifier which the managed update was applied. This uniquely + /// identifies the symbol file.For Microsoft C++ or Microsoft .NET Framework binaries, + /// this is a unique value which is embedded in an exe/dll by linkers/compilers when the + /// dll/exe is built. A new value is generated each time that the dll/exe is compiled. + /// + [DataMember(Name = "module")] + public Guid Module { get; } + + /// + /// Collection of IL deltas affected by the update. Required by ICorDebugModule2::ApplyChanges. + /// + [DataMember(Name = "ilDelta")] + public ImmutableArray ILDelta { get; } + + /// + /// Collection of metadata deltas affected by the update. Required by ICorDebugModule2::ApplyChanges. + /// + [DataMember(Name = "metadataDelta")] + public ImmutableArray MetadataDelta { get; } + + /// + /// Collection of PDB deltas regarding the symbol information affected by the update. + /// + [DataMember(Name = "pdbDelta")] + public ImmutableArray PdbDelta { get; } + + /// + /// Collection of sequence points affected by the update. + /// This will alter the line number for one or more existing sequence point in the symbolic data. + /// + [DataMember(Name = "sequencePoints")] + public ImmutableArray SequencePoints { get; } + + /// + /// Method token for all the methods affected by the update. + /// + [DataMember(Name = "updatedMethods")] + public ImmutableArray UpdatedMethods { get; } + + /// + /// List of TypeDefs that have been modified during an edit. + /// This is passed on to the CLR as an event on each EnC update. + /// + [DataMember(Name = "updatedTypes")] + public ImmutableArray UpdatedTypes { get; } + + /// + /// Collection of active statements affected by the update. + /// This will not list duplicate active statements in multiple threads and will report an unique one instead. + /// + [DataMember(Name = "activeStatements")] + public ImmutableArray ActiveStatements { get; } + + /// + /// Collection of exception regions affected by the update. An exception region is enclosed by a try/catch/finally block. + /// + [DataMember(Name = "exceptionRegions")] + public ImmutableArray ExceptionRegions { get; } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdateStatus.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdateStatus.cs new file mode 100644 index 0000000000000..c7adef36950b5 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/ManagedModuleUpdateStatus.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Indicates the state of a manage module update. + /// + internal enum ManagedModuleUpdateStatus + { + /// + /// No change made. + /// + None = 0, + + /// + /// All changes are valid, can be applied. + /// + Ready = 1, + + /// + /// Changes require restarting the application in order to be applied. + /// + RestartRequired = 2, + + /// + /// Some changes are errors that block rebuild of the module. + /// This means that the code is in a broken state that cannot be resolved by restarting the application. + /// + Blocked = 3 + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SequencePointUpdates.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SequencePointUpdates.cs new file mode 100644 index 0000000000000..33a384f594388 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SequencePointUpdates.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using System.Collections.Immutable; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Sequence points affected by an update on a specified file. + /// + [DataContract] + internal readonly struct SequencePointUpdates + { + /// + /// Creates a SequencePointsUpdate. + /// + /// Name of the file which was modified. + /// Collection of the file lines affected by the update. + public SequencePointUpdates( + string fileName, + ImmutableArray lineUpdates) + { + FileName = fileName; + LineUpdates = lineUpdates; + } + + /// + /// Name of the modified file as stored in PDB. + /// + [DataMember(Name = "fileName")] + public string FileName { get; } + + /// + /// Collection of the file lines affected by the update. + /// + [DataMember(Name = "lineUpdates")] + public ImmutableArray LineUpdates { get; } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceLineUpdate.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceLineUpdate.cs new file mode 100644 index 0000000000000..1b5c91d7efbdf --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceLineUpdate.cs @@ -0,0 +1,54 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using System; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Maps source lines affected by an update. + /// Zero-based line number. + /// + [DataContract] + internal readonly struct SourceLineUpdate + { + /// + /// Creates a SourceLineUpdate. + /// + /// Line number before the update was made. + /// Line number after the update was made. + /// + /// If or is less than 0. + /// + /// + /// We expect that and have the same value + /// when the line delta is zero. + /// + public SourceLineUpdate( + int oldLine, + int newLine) + { + if (oldLine < 0) + throw new ArgumentOutOfRangeException(nameof(oldLine)); + if (newLine < 0) + throw new ArgumentOutOfRangeException(nameof(newLine)); + + OldLine = oldLine; + NewLine = newLine; + } + + /// + /// Line number before the update was made, must be zero-based. + /// + [DataMember(Name = "oldLine")] + public int OldLine { get; } + + /// + /// Line number after the update was made, must be zero-based. + /// + [DataMember(Name = "newLine")] + public int NewLine { get; } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceSpan.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceSpan.cs new file mode 100644 index 0000000000000..53aac63e2f2ee --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/EditAndContinue/SourceSpan.cs @@ -0,0 +1,109 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// The start/end line/column ranges for a contiguous span of text. These should be all zero-indexed. + /// This is an alias for TextSpan structures. + /// + [DataContract] + [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] + internal readonly struct SourceSpan : IEquatable + { + /// + /// Creates a TextSpan. + /// + /// Start line. + /// Start column. -1 if column information is missing. + /// End line. + /// End column. -1 if column information is missing. + /// + /// If or is less than zero. + /// If or is less than -1. + /// If only or is -1. + /// + public SourceSpan( + int startLine, + int startColumn, + int endLine, + int endColumn) + { + if (startLine < 0) + throw new ArgumentOutOfRangeException(nameof(startLine)); + if (startColumn < -1) + throw new ArgumentOutOfRangeException(nameof(startColumn)); + if (endLine < 0) + throw new ArgumentOutOfRangeException(nameof(endLine)); + if (endColumn < -1) + throw new ArgumentOutOfRangeException(nameof(endColumn)); + + if ((startColumn == -1 || endColumn == -1) && startColumn != endColumn) + throw new ArgumentOutOfRangeException(startColumn == -1 ? nameof(endColumn) : nameof(startColumn)); + + StartLine = startLine; + StartColumn = startColumn; + EndLine = endLine; + EndColumn = endColumn; + } + + /// + /// Zero-based integer for the starting source line. + /// + [DataMember(Name = "startLine")] + public int StartLine { get; } + + /// + /// Zero-based integer for the starting source column. If column information is missing (e.g. language service doesn't support it), + /// this value should be treated as -1. + /// + [DataMember(Name = "startColumn")] + public int StartColumn { get; } + + /// + /// Zero-based integer for the ending source line. + /// + [DataMember(Name = "endLine")] + public int EndLine { get; } + + /// + /// Zero-based integer for the ending source column. If column information is missing (e.g. language service doesn't support it), + /// this value should be treated as -1. + /// + [DataMember(Name = "endColumn")] + public int EndColumn { get; } + + public bool Equals(SourceSpan other) + { + return StartLine == other.StartLine && + StartColumn == other.StartColumn && + EndLine == other.EndLine && + EndColumn == other.EndColumn; + } + + public override bool Equals(object? obj) => obj is SourceSpan span && Equals(span); + + public override int GetHashCode() + { + return + ((StartLine & 0xffff) << 16) | // bytes 3, 2 are a hash for start line + ((StartColumn & 0xff) << 8) | // byte 1 is a hash for start column + ((EndLine ^ EndColumn) % 255); // byte 0 is a hash for end line and column + } + + public static bool operator ==(SourceSpan left, SourceSpan right) => left.Equals(right); + + public static bool operator !=(SourceSpan left, SourceSpan right) => !(left == right); + + internal string GetDebuggerDisplay() => + (StartColumn >= 0) ? + $"({StartLine},{StartColumn})-({EndLine},{EndColumn})" : + $"{StartLine}-{EndLine}"; + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/HotReloadResult.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/HotReloadResult.cs new file mode 100644 index 0000000000000..b62eff051e7a9 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/HotReloadResult.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Result for a hot reload apply operation. + /// + internal enum HotReloadResult + { + /// + /// Successfully applied the changes. + /// + Applied = 0, + + /// + /// No changes were found. + /// + NoChanges = 1, + + /// + /// Rude edits were found. + /// Changes can be applied by restarting the session. + /// + RestartRequired = 2, + + /// + /// Edits with a compiler error were found. + /// This assumes that the agents do not support restart and any rude edits were treated as errors. + /// + ErrorEdits = 3, + + /// + /// An internal error was found while applying code updates. This will generally be propagated through an exception. + /// + ApplyUpdateFailure = 4 + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/IManagedHotReloadService.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/IManagedHotReloadService.cs new file mode 100644 index 0000000000000..c5866489d1765 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/IManagedHotReloadService.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Service for providing helper functionality to a language service regarding hot reload and Edit and Continue operations. + /// This is currently exported through MEF. + /// + internal interface IManagedHotReloadService + { + /// + /// Retrieves a list of active statements for the debugging session. + /// Shall only be called while the debugger is stopped (break mode). + /// Returns empty array if no debugger is present. + /// + /// Cancellation token. + /// + /// Returns all the active statements in the session. Each has an unique . + /// For example, if an instruction is active in two different threads, only one active statement will be reported for it. + /// + ValueTask> GetActiveStatementsAsync(CancellationToken cancellation); + + /// + /// Check for Edit and Continue availability on all instances with specified . + /// If no debugger is present, this will check if there are any agents available for hot reload or whether + /// the user has disabled Edit and Continue or hot reload. + /// + /// Target module version identifier. This is only used when under a debugging session. + /// Cancellation token. + /// + /// Returns first status that's not , if any. + /// Otherwise, if there is at least one instance of the module loaded in a debugging session or there are active hot reload agents, returns . + /// Otherwise, returns . + /// + ValueTask GetAvailabilityAsync(Guid module, CancellationToken cancellation); + + /// + /// Notifies the debugger that a document has changed, which may affect the given module when that change is applied. + /// Calls ISymUnmanagedEncUpdate.InitializeForEnc on SymReader for the given module. + /// No-op if no debugger is present. + /// + /// Module version identifier. + /// Cancellation token. + ValueTask PrepareModuleForUpdateAsync(Guid module, CancellationToken cancellation); + + /// + /// Get capabilities string for the set of hot reload edits supported by the runtime. + /// + /// Cancellation token. + /// + /// Returns an array of identifiers. If different agents have different capabilities, it's up to the manager + /// to merge them and present unified set of capabilities to the language service. + /// The merging policy is entirely dependent on how the manager applies changes to multiple runtimes. + /// + ValueTask> GetCapabilitiesAsync(CancellationToken cancellation); + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailability.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailability.cs new file mode 100644 index 0000000000000..6f85e1c795b14 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailability.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Managed hot reload availability information. + /// + [DataContract] + internal readonly struct ManagedHotReloadAvailability + { + public ManagedHotReloadAvailability( + ManagedHotReloadAvailabilityStatus status, + string? localizedMessage = null) + { + Status = status; + LocalizedMessage = localizedMessage; + } + + /// + /// Status for the managed hot reload session. + /// + [DataMember(Name = "status")] + public ManagedHotReloadAvailabilityStatus Status { get; } + + /// + /// [Optional] Localized message for . + /// + [DataMember(Name = "localizedMessage")] + public string? LocalizedMessage { get; } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailabilityStatus.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailabilityStatus.cs new file mode 100644 index 0000000000000..ba819f4119695 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadAvailabilityStatus.cs @@ -0,0 +1,120 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Availability status for applying changes under a session. + /// + /// + /// Do not change the value for any of the preexisting status, as this is the value + /// used when reporting telemetry. + /// + internal enum ManagedHotReloadAvailabilityStatus + { + /// + /// Applying changes is available to the current session. + /// + Available = 0, + + /// + /// Edit and Continue not supported due to interop debugging. + /// + Interop = 1, + + /// + /// Unable to edit code running in SQL server. + /// + SqlClr = 2, + + /// + /// Edit and Continue not supported in minidump debugging. + /// + Minidump = 3, + + /// + /// Edit and Continue not supported since debugger was attached to a process that + /// does not support EnC on attach. + /// + Attach = 4, + + /// + /// Edit and Continue not supported if the assembly has not been loaded. + /// + ModuleNotLoaded = 5, + + /// + /// Edit and Continue not supported if the assembly that has been modified during + /// debugging is reloaded. + /// + ModuleReloaded = 6, + + /// + /// Edit and Continue not supported if the source code on disk does not match the + /// code running in the process. + /// + NotBuilt = 8, + + /// + /// Edit and Continue not supported for the current engine. + /// + UnsupportedEngine = 9, + + /// + /// Edit and Continue in a 64-bit process requires .NET Framework version 4.5.1 or + /// higher. + /// + NotSupportedForClr64Version = 10, + + /// + /// Edit and Continue not supported on the current module. This is a fallback + /// scenario in case we fail to determine the exact reason the module does not + /// support EnC. + /// + NotAllowedForModule = 11, + + /// + /// Edit and Continue not supported if code was optimized. + /// + Optimized = 12, + + /// + /// Edit and Continue not supported if assembly was loaded as domain-neutral. + /// + DomainNeutralAssembly = 13, + + /// + /// Edit and Continue not supported if assembly was loaded through reflection. + /// + ReflectionAssembly = 14, + + /// + /// Edit and Continue not supported if IntelliTrace events and call information is + /// enabled. + /// + IntelliTrace = 15, + + /// + /// Edit and Continue not supported on the .NET Runtime the program is running. + /// + NotAllowedForRuntime = 16, + + /// + /// Edit and Continue not supported due to an internal error in the debugger. + /// + InternalError = 17, + + /// + /// Edit and Continue is unavailable, e.g. no suitable engine providers were found. + /// + Unavailable = 18, + + /// + /// Applying changes has been disabled by the client. + /// If debugging, this means Edit and Continue has been disabled. + /// If not debugging, this means hot reload has been disabled. + /// + Disabled = 19 + }; +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnostic.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnostic.cs new file mode 100644 index 0000000000000..97f77970f7fd1 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnostic.cs @@ -0,0 +1,67 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Diagnostic information about a particular edit made through hot reload. + /// + [DataContract] + internal readonly struct ManagedHotReloadDiagnostic + { + /// + /// Creates a new for an edit made by the user. + /// + /// Diagnostic information identifier. + /// User message. + /// Severity of the edit, whether it's an error or a warning. + /// File path for the target edit. + /// Source span of the edit. + public ManagedHotReloadDiagnostic( + string id, + string message, + ManagedHotReloadDiagnosticSeverity severity, + string filePath, + SourceSpan span) + { + Id = id; + Message = message; + Severity = severity; + FilePath = filePath; + Span = span; + } + + /// + /// Diagnostic information identifier. + /// + [DataMember(Name = "id")] + public string Id { get; } + + /// + /// User message which will be displayed for the edit. + /// + [DataMember(Name = "message")] + public string Message { get; } + + /// + /// Severity of the diagnostic information. + /// + [DataMember(Name = "severity")] + public ManagedHotReloadDiagnosticSeverity Severity { get; } + + /// + /// File path where the edit was made. + /// + [DataMember(Name = "filePath")] + public string FilePath { get; } + + /// + /// Source span for the edit. + /// + [DataMember(Name = "span")] + public SourceSpan Span { get; } + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnosticSeverity.cs b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnosticSeverity.cs new file mode 100644 index 0000000000000..d2e7c8b801152 --- /dev/null +++ b/src/Features/Core/Portable/EditAndContinue/Contracts/HotReload/ManagedHotReloadDiagnosticSeverity.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.EditAndContinue.Contracts +{ + /// + /// Severity of a rude edit made by the user. + /// + internal enum ManagedHotReloadDiagnosticSeverity + { + /// + /// Diagnostic for a warning. + /// + Warning = 1, + + /// + /// Diagnostic for a rude edit. + /// This is a less severe diagnostic and can be generally addressed by restarting the application. + /// + RestartRequired = 2, + + /// + /// Diagnostic for a compiler error. + /// This means we can't do anything until the error is fixed. + /// + Error = 3 + } +} diff --git a/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs b/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs index aea3873c58fa7..65e45cd4e71d2 100644 --- a/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs +++ b/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs @@ -19,8 +19,7 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs b/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs index d0b9dfaba6884..eea71ccfa59c7 100644 --- a/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs +++ b/src/Features/Core/Portable/EditAndContinue/DocumentAnalysisResults.cs @@ -7,7 +7,7 @@ using System.Diagnostics; using System.Linq; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs b/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs index 4be687741d3f8..b97cd29aed5d0 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs @@ -7,8 +7,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/EditAndContinueWorkspaceService.cs b/src/Features/Core/Portable/EditAndContinue/EditAndContinueWorkspaceService.cs index 33e1503429142..6a17372e3c25b 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditAndContinueWorkspaceService.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditAndContinueWorkspaceService.cs @@ -13,8 +13,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/EditSession.cs b/src/Features/Core/Portable/EditAndContinue/EditSession.cs index 1b3f560c94794..55aa36c84b04e 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditSession.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditSession.cs @@ -18,8 +18,7 @@ using Microsoft.CodeAnalysis.Shared.Collections; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/EmitSolutionUpdateResults.cs b/src/Features/Core/Portable/EditAndContinue/EmitSolutionUpdateResults.cs index 83916ca601dcc..8c1d0d82e69c4 100644 --- a/src/Features/Core/Portable/EditAndContinue/EmitSolutionUpdateResults.cs +++ b/src/Features/Core/Portable/EditAndContinue/EmitSolutionUpdateResults.cs @@ -11,8 +11,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/Extensions.cs b/src/Features/Core/Portable/EditAndContinue/Extensions.cs index cd16f1812e6a1..8bce6176d1ed0 100644 --- a/src/Features/Core/Portable/EditAndContinue/Extensions.cs +++ b/src/Features/Core/Portable/EditAndContinue/Extensions.cs @@ -4,7 +4,7 @@ using System.Collections.Immutable; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.EditAndContinue diff --git a/src/Features/Core/Portable/EditAndContinue/IEditAndContinueWorkspaceService.cs b/src/Features/Core/Portable/EditAndContinue/IEditAndContinueWorkspaceService.cs index bf5683ea5052a..eb9902dd87830 100644 --- a/src/Features/Core/Portable/EditAndContinue/IEditAndContinueWorkspaceService.cs +++ b/src/Features/Core/Portable/EditAndContinue/IEditAndContinueWorkspaceService.cs @@ -7,8 +7,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/ManagedModuleUpdateStatusEx.cs b/src/Features/Core/Portable/EditAndContinue/ManagedModuleUpdateStatusEx.cs index 18a65fe0e424b..f40323761a24d 100644 --- a/src/Features/Core/Portable/EditAndContinue/ManagedModuleUpdateStatusEx.cs +++ b/src/Features/Core/Portable/EditAndContinue/ManagedModuleUpdateStatusEx.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/PendingSolutionUpdate.cs b/src/Features/Core/Portable/EditAndContinue/PendingSolutionUpdate.cs index b362c933c56e7..687318753264b 100644 --- a/src/Features/Core/Portable/EditAndContinue/PendingSolutionUpdate.cs +++ b/src/Features/Core/Portable/EditAndContinue/PendingSolutionUpdate.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Emit; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs b/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs index 954d7586199b1..ccc5b18befe67 100644 --- a/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs +++ b/src/Features/Core/Portable/EditAndContinue/ProjectChanges.cs @@ -5,7 +5,7 @@ using System.Collections.Immutable; using System.Diagnostics; using Microsoft.CodeAnalysis.Emit; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/Remote/DebuggerContractVersionCheck.cs b/src/Features/Core/Portable/EditAndContinue/Remote/DebuggerContractVersionCheck.cs index 93b8c909d9ae1..c522bf3632570 100644 --- a/src/Features/Core/Portable/EditAndContinue/Remote/DebuggerContractVersionCheck.cs +++ b/src/Features/Core/Portable/EditAndContinue/Remote/DebuggerContractVersionCheck.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.CompilerServices; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/Remote/IRemoteEditAndContinueService.cs b/src/Features/Core/Portable/EditAndContinue/Remote/IRemoteEditAndContinueService.cs index 7dcc2e86540fd..1bf1615bb0343 100644 --- a/src/Features/Core/Portable/EditAndContinue/Remote/IRemoteEditAndContinueService.cs +++ b/src/Features/Core/Portable/EditAndContinue/Remote/IRemoteEditAndContinueService.cs @@ -9,8 +9,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/Remote/RemoteDebuggingSessionProxy.cs b/src/Features/Core/Portable/EditAndContinue/Remote/RemoteDebuggingSessionProxy.cs index 684876e16014f..6832ab34f6774 100644 --- a/src/Features/Core/Portable/EditAndContinue/Remote/RemoteDebuggingSessionProxy.cs +++ b/src/Features/Core/Portable/EditAndContinue/Remote/RemoteDebuggingSessionProxy.cs @@ -16,7 +16,7 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/Remote/RemoteEditAndContinueServiceProxy.cs b/src/Features/Core/Portable/EditAndContinue/Remote/RemoteEditAndContinueServiceProxy.cs index eac5f422ea349..ef896e940f5a9 100644 --- a/src/Features/Core/Portable/EditAndContinue/Remote/RemoteEditAndContinueServiceProxy.cs +++ b/src/Features/Core/Portable/EditAndContinue/Remote/RemoteEditAndContinueServiceProxy.cs @@ -13,8 +13,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Remote; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/EditAndContinue/SolutionUpdate.cs b/src/Features/Core/Portable/EditAndContinue/SolutionUpdate.cs index 4bd2645d50d52..ed05d4ae20545 100644 --- a/src/Features/Core/Portable/EditAndContinue/SolutionUpdate.cs +++ b/src/Features/Core/Portable/EditAndContinue/SolutionUpdate.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Emit; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue { diff --git a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingHotReloadService.cs b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingHotReloadService.cs index 470d717a5dc32..abe08f1925be1 100644 --- a/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingHotReloadService.cs +++ b/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingHotReloadService.cs @@ -8,8 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api diff --git a/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs b/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs index 9e96b58e96750..d9efe3de63314 100644 --- a/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs +++ b/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs @@ -9,8 +9,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.ExternalAccess.Watch.Api diff --git a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj index 0cb129463eb3d..0c1bd9b597474 100644 --- a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj +++ b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj @@ -129,13 +129,6 @@ - - - - - - - diff --git a/src/Features/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Features.vbproj b/src/Features/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Features.vbproj index e5f1d2208aa4a..ac8c80c68fbea 100644 --- a/src/Features/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Features.vbproj +++ b/src/Features/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Features.vbproj @@ -55,10 +55,6 @@ InternalUtilities\LambdaUtilities.vb - - - - diff --git a/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj b/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj index 117cc3aef212b..b9c2de05e6368 100644 --- a/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj +++ b/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj @@ -124,7 +124,6 @@ - diff --git a/src/Workspaces/Remote/ServiceHub/Services/EditAndContinue/RemoteEditAndContinueService.cs b/src/Workspaces/Remote/ServiceHub/Services/EditAndContinue/RemoteEditAndContinueService.cs index 0753352868510..d81e3f5f7d760 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/EditAndContinue/RemoteEditAndContinueService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/EditAndContinue/RemoteEditAndContinueService.cs @@ -13,8 +13,7 @@ using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Debugger.Contracts.HotReload; -using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue; +using Microsoft.CodeAnalysis.EditAndContinue.Contracts; namespace Microsoft.CodeAnalysis.EditAndContinue {