Skip to content

Commit

Permalink
Merge pull request #57578 from dotnet/release/dev17.0-vs-deps
Browse files Browse the repository at this point in the history
Merge release/dev17.0-vs-deps to release/dev17.0
  • Loading branch information
JoeRobich authored Nov 4, 2021
2 parents a98c2d6 + 7dd1c0d commit eec23f6
Show file tree
Hide file tree
Showing 81 changed files with 1,658 additions and 450 deletions.
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
<MicrosoftVisualStudioComponentModelHostVersion>$(VisualStudioEditorNewPackagesVersion)</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualStudioCompositionVersion>16.9.20</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioCoreUtilityVersion>$(VisualStudioEditorNewPackagesVersion)</MicrosoftVisualStudioCoreUtilityVersion>
<MicrosoftVisualStudioDebuggerUIInterfacesVersion>17.2.0-beta.21417.1</MicrosoftVisualStudioDebuggerUIInterfacesVersion>
<MicrosoftVisualStudioDebuggerContractsVersion>17.2.0</MicrosoftVisualStudioDebuggerContractsVersion>
<MicrosoftVisualStudioDebuggerUIInterfacesVersion>17.2.0-beta.21477.1</MicrosoftVisualStudioDebuggerUIInterfacesVersion>
<MicrosoftVisualStudioDebuggerContractsVersion>17.2.0-beta.21477.1</MicrosoftVisualStudioDebuggerContractsVersion>
<MicrosoftVisualStudioDebuggerEngineimplementationVersion>17.0.1042805-preview</MicrosoftVisualStudioDebuggerEngineimplementationVersion>
<MicrosoftVisualStudioDebuggerMetadataimplementationVersion>17.0.1042805-preview</MicrosoftVisualStudioDebuggerMetadataimplementationVersion>
<MicrosoftVisualStudioDesignerInterfacesVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioDesignerInterfacesVersion>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sdk": {
"version": "6.0.100-rc.2.21505.57",
"allowPrerelease": true,
"rollForward": "major"
"rollForward": "disable"
},
"tools": {
"dotnet": "6.0.100-rc.2.21505.57",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -11074,11 +11074,11 @@ public static void F()
var edits = GetTopEdits(src1, src2);
var active = GetActiveStatements(src1, src2, flags: new[]
{
ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.IsLeafFrame,
ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.IsNonLeafFrame,
ActiveStatementFlags.IsLeafFrame,
ActiveStatementFlags.IsNonLeafFrame,
ActiveStatementFlags.IsNonLeafFrame | ActiveStatementFlags.IsLeafFrame
ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.LeafFrame,
ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.NonLeafFrame,
ActiveStatementFlags.LeafFrame,
ActiveStatementFlags.NonLeafFrame,
ActiveStatementFlags.NonLeafFrame | ActiveStatementFlags.LeafFrame
});

edits.VerifyRudeDiagnostics(active,
Expand Down Expand Up @@ -11109,7 +11109,7 @@ public static void F()
var edits = GetTopEdits(src1, src2);
var active = GetActiveStatements(src1, src2, flags: new[]
{
ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.IsLeafFrame
ActiveStatementFlags.PartiallyExecuted | ActiveStatementFlags.LeafFrame
});

edits.VerifyRudeDiagnostics(active,
Expand Down Expand Up @@ -11137,7 +11137,7 @@ public static void F()
var edits = GetTopEdits(src1, src2);
var active = GetActiveStatements(src1, src2, flags: new[]
{
ActiveStatementFlags.IsNonLeafFrame | ActiveStatementFlags.IsLeafFrame
ActiveStatementFlags.NonLeafFrame | ActiveStatementFlags.LeafFrame
});

edits.VerifyRudeDiagnostics(active,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -159,15 +159,15 @@ public async Task TrackingService_GetLatestSpansAsync(bool scheduleInitialTracki

spanProvider.GetBaseActiveStatementSpansImpl = (_, documentIds) => ImmutableArray.Create(
ImmutableArray.Create(
new ActiveStatementSpan(0, span11, ActiveStatementFlags.IsNonLeafFrame, unmappedDocumentId: null),
new ActiveStatementSpan(1, span12, ActiveStatementFlags.IsLeafFrame, unmappedDocumentId: null)),
new ActiveStatementSpan(0, span11, ActiveStatementFlags.NonLeafFrame, unmappedDocumentId: null),
new ActiveStatementSpan(1, span12, ActiveStatementFlags.LeafFrame, unmappedDocumentId: null)),
ImmutableArray<ActiveStatementSpan>.Empty);

spanProvider.GetAdjustedActiveStatementSpansImpl = (document, _) => document.Name switch
{
"1.cs" => ImmutableArray.Create(
new ActiveStatementSpan(0, span21, ActiveStatementFlags.IsNonLeafFrame, unmappedDocumentId: null),
new ActiveStatementSpan(1, span22, ActiveStatementFlags.IsLeafFrame, unmappedDocumentId: null)),
new ActiveStatementSpan(0, span21, ActiveStatementFlags.NonLeafFrame, unmappedDocumentId: null),
new ActiveStatementSpan(1, span22, ActiveStatementFlags.LeafFrame, unmappedDocumentId: null)),
"2.cs" => ImmutableArray<ActiveStatementSpan>.Empty,
_ => throw ExceptionUtilities.Unreachable
};
Expand Down Expand Up @@ -198,8 +198,8 @@ public async Task TrackingService_GetLatestSpansAsync(bool scheduleInitialTracki
var spans1 = trackingSession.Test_GetTrackingSpans();
AssertEx.Equal(new[]
{
$"V0 →←@[10..15): IsNonLeafFrame",
$"V0 →←@[20..25): IsLeafFrame"
$"V0 →←@[10..15): NonLeafFrame",
$"V0 →←@[20..25): LeafFrame"
}, spans1[document1.FilePath].Select(s => $"{s.Span}: {s.Flags}"));

var spans2 = await trackingSession.GetSpansAsync(solution, document1.Id, document1.FilePath, CancellationToken.None);
Expand All @@ -212,8 +212,8 @@ public async Task TrackingService_GetLatestSpansAsync(bool scheduleInitialTracki
var spans4 = await trackingSession.GetAdjustedTrackingSpansAsync(document1, snapshot1, CancellationToken.None);
AssertEx.Equal(new[]
{
$"V0 →←@[11..16): IsNonLeafFrame",
$"V0 →←@[21..26): IsLeafFrame"
$"V0 →←@[11..16): NonLeafFrame",
$"V0 →←@[21..26): LeafFrame"
}, spans4.Select(s => $"{s.Span}: {s.Flags}"));

AssertEx.Empty(await trackingSession.GetAdjustedTrackingSpansAsync(document2, snapshot2, CancellationToken.None));
Expand All @@ -225,8 +225,8 @@ public async Task TrackingService_GetLatestSpansAsync(bool scheduleInitialTracki
var spans5 = trackingSession.Test_GetTrackingSpans();
AssertEx.Equal(new[]
{
$"V0 →←@[11..16): IsNonLeafFrame",
$"V0 →←@[21..26): IsLeafFrame"
$"V0 →←@[11..16): NonLeafFrame",
$"V0 →←@[21..26): LeafFrame"
}, spans5[document1.FilePath].Select(s => $"{s.Span}: {s.Flags}"));
}

Expand All @@ -236,8 +236,8 @@ public async Task TrackingService_GetLatestSpansAsync(bool scheduleInitialTracki
var spans6 = await trackingSession.GetAdjustedTrackingSpansAsync(document1, snapshot1, CancellationToken.None);
AssertEx.Equal(new[]
{
$"V0 →←@[11..16): IsNonLeafFrame",
$"V0 →←@[21..26): IsLeafFrame"
$"V0 →←@[11..16): NonLeafFrame",
$"V0 →←@[21..26): LeafFrame"
}, spans6.Select(s => $"{s.Span}: {s.Flags}"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -307,7 +307,7 @@ public static void Main()
KeyValuePairUtil.Create(newDocument.FilePath, ImmutableArray.Create(
new ActiveStatement(
ordinal: 0,
ActiveStatementFlags.IsLeafFrame,
ActiveStatementFlags.LeafFrame,
new SourceFileSpan(newDocument.FilePath, oldStatementSpan),
instructionId: default)))
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +27,7 @@ public ActiveStatementTrackingSpan(ITrackingSpan trackingSpan, int ordinal, Acti
/// <summary>
/// True if at least one of the threads whom this active statement belongs to is in a leaf frame.
/// </summary>
public bool IsLeaf => (Flags & ActiveStatementFlags.IsLeafFrame) != 0;
public bool IsLeaf => (Flags & ActiveStatementFlags.LeafFrame) != 0;

public static ActiveStatementTrackingSpan Create(ITextSnapshot snapshot, ActiveStatementSpan span)
=> new(snapshot.CreateTrackingSpan(snapshot.GetTextSpan(span.LineSpan).ToSpan(), SpanTrackingMode.EdgeExclusive), span.Ordinal, span.Flags, span.UnmappedDocumentId);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ManagedHotReloadDiagnostic> FromContract(this ImmutableArray<Contracts.ManagedHotReloadDiagnostic> 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));
}
}
Original file line number Diff line number Diff line change
@@ -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<ImmutableArray<Contracts.ManagedActiveStatementDebugInfo>> GetActiveStatementsAsync(CancellationToken cancellation)
=> (await _service.GetActiveStatementsAsync(cancellation).ConfigureAwait(false)).SelectAsArray(a => a.ToContract());

public async ValueTask<Contracts.ManagedHotReloadAvailability> GetAvailabilityAsync(Guid module, CancellationToken cancellation)
=> (await _service.GetAvailabilityAsync(module, cancellation).ConfigureAwait(false)).ToContract();

public ValueTask<ImmutableArray<string>> GetCapabilitiesAsync(CancellationToken cancellation)
=> _service.GetCapabilitiesAsync(cancellation);

public ValueTask PrepareModuleForUpdateAsync(Guid module, CancellationToken cancellation)
=> _service.PrepareModuleForUpdateAsync(module, cancellation);
}
}
Original file line number Diff line number Diff line change
@@ -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.Runtime.CompilerServices;
using Microsoft.VisualStudio.Debugger.Contracts.HotReload;

namespace Microsoft.CodeAnalysis.EditAndContinue
{
/// <summary>
/// Temporaroly needed to allow us to run integration tests on older VS than build that has the required version of Microsoft.VisualStudio.Debugger.Contracts.
/// TODO: Remove (https://github.com/dotnet/roslyn/issues/56742)
/// </summary>
internal static class DebuggerContractVersionCheck
{
public static bool IsRequiredDebuggerContractVersionAvailable()
{
try
{
_ = LoadContracts();
return true;
}
catch
{
return false;
}
}

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static Type LoadContracts()
=> typeof(ManagedHotReloadAvailability);
}
}
Loading

0 comments on commit eec23f6

Please sign in to comment.