Skip to content

Commit

Permalink
Merge pull request #63242 from dotnet/merges/main-to-main-vs-deps
Browse files Browse the repository at this point in the history
Merge main to main-vs-deps
  • Loading branch information
dotnet-bot authored Aug 5, 2022
2 parents 3fe1453 + 4a1f4d3 commit d35ab64
Show file tree
Hide file tree
Showing 31 changed files with 279 additions and 558 deletions.
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
<MicrosoftVisualStudioComponentModelHostVersion>17.3.37-preview</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualStudioCompositionVersion>16.9.20</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioCoreUtilityVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioCoreUtilityVersion>
<MicrosoftVisualStudioDebuggerUIInterfacesVersion>17.3.0-beta.22253.1</MicrosoftVisualStudioDebuggerUIInterfacesVersion>
<MicrosoftVisualStudioDebuggerContractsVersion>17.3.0-beta.22253.1</MicrosoftVisualStudioDebuggerContractsVersion>
<MicrosoftVisualStudioDebuggerUIInterfacesVersion>17.4.0-beta.22368.1</MicrosoftVisualStudioDebuggerUIInterfacesVersion>
<MicrosoftVisualStudioDebuggerContractsVersion>17.4.0-beta.22368.1</MicrosoftVisualStudioDebuggerContractsVersion>
<MicrosoftVisualStudioDebuggerEngineimplementationVersion>17.0.1042805-preview</MicrosoftVisualStudioDebuggerEngineimplementationVersion>
<MicrosoftVisualStudioDebuggerMetadataimplementationVersion>17.0.1042805-preview</MicrosoftVisualStudioDebuggerMetadataimplementationVersion>
<MicrosoftVisualStudioDesignerInterfacesVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioDesignerInterfacesVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,21 @@ public static Contracts.SourceSpan ToContract(this SourceSpan id)
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)
public static ManagedHotReloadUpdate FromContract(this ModuleUpdate 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));
module: update.Module,
ilDelta: update.ILDelta,
metadataDelta: update.MetadataDelta,
pdbDelta: update.PdbDelta,
updatedTypes: update.UpdatedTypes,
requiredCapabilities: update.RequiredCapabilities.ToStringArray(),
updatedMethods: update.UpdatedMethods,
sequencePoints: update.SequencePoints.SelectAsArray(FromContract),
activeStatements: update.ActiveStatements.SelectAsArray(FromContract),
exceptionRegions: update.ExceptionRegions.SelectAsArray(FromContract));

public static ImmutableArray<ManagedHotReloadUpdate> FromContract(this ImmutableArray<ModuleUpdate> diagnostics)
=> diagnostics.SelectAsArray(FromContract);

public static SequencePointUpdates FromContract(this Contracts.SequencePointUpdates updates)
=> new(updates.FileName, updates.LineUpdates.SelectAsArray(FromContract));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
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)
/// Allow us to run integration tests on older VS than build that has the required version of Microsoft.VisualStudio.Debugger.Contracts.
/// </summary>
internal static class DebuggerContractVersionCheck
{
Expand All @@ -29,6 +28,6 @@ public static bool IsRequiredDebuggerContractVersionAvailable()

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static Type LoadContracts()
=> typeof(ManagedHotReloadAvailability);
=> typeof(ManagedActiveStatementUpdate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ namespace Microsoft.CodeAnalysis.EditAndContinue
[ExportMetadata("UIContext", EditAndContinueUIContext.EncCapableProjectExistsInWorkspaceUIContextString)]
internal sealed class EditAndContinueLanguageService : IManagedHotReloadLanguageService, IEditAndContinueSolutionProvider
{
private static readonly ActiveStatementSpanProvider s_noActiveStatementSpanProvider =
(_, _, _) => ValueTaskFactory.FromResult(ImmutableArray<ActiveStatementSpan>.Empty);

private readonly Lazy<IManagedHotReloadService> _debuggerService;
private readonly IDiagnosticAnalyzerService _diagnosticService;
private readonly EditAndContinueDiagnosticUpdateSource _diagnosticUpdateSource;
Expand Down Expand Up @@ -293,29 +290,7 @@ await EditSession.HasChangesAsync(oldSolution, newSolution, sourceFilePath, canc
}
}

public async ValueTask<ManagedModuleUpdates> GetEditAndContinueUpdatesAsync(CancellationToken cancellationToken)
{
if (_disabled)
{
return new ManagedModuleUpdates(ManagedModuleUpdateStatus.None, ImmutableArray<ManagedModuleUpdate>.Empty);
}

var workspace = WorkspaceProvider.Value.Workspace;
var designTimeSolution = workspace.CurrentSolution;
var solution = GetCurrentCompileTimeSolution(designTimeSolution);
var activeStatementSpanProvider = GetActiveStatementSpanProvider(solution);
var (updates, _, _, _) = await GetDebuggingSession().EmitSolutionUpdateAsync(solution, activeStatementSpanProvider, _diagnosticService, _diagnosticUpdateSource, cancellationToken).ConfigureAwait(false);

// Only store the solution if we have any changes to apply, otherwise CommitUpdatesAsync/DiscardUpdatesAsync won't be called.
if (updates.Status == Contracts.ManagedModuleUpdateStatus.Ready)
{
_pendingUpdatedDesignTimeSolution = designTimeSolution;
}

return updates.FromContract();
}

public async ValueTask<ManagedHotReloadUpdates> GetHotReloadUpdatesAsync(CancellationToken cancellationToken)
public async ValueTask<ManagedHotReloadUpdates> GetUpdatesAsync(CancellationToken cancellationToken)
{
if (_disabled)
{
Expand All @@ -325,20 +300,17 @@ public async ValueTask<ManagedHotReloadUpdates> GetHotReloadUpdatesAsync(Cancell
var workspace = WorkspaceProvider.Value.Workspace;
var designTimeSolution = workspace.CurrentSolution;
var solution = GetCurrentCompileTimeSolution(designTimeSolution);
var (moduleUpdates, diagnosticData, rudeEdits, syntaxError) = await GetDebuggingSession().EmitSolutionUpdateAsync(solution, s_noActiveStatementSpanProvider, _diagnosticService, _diagnosticUpdateSource, cancellationToken).ConfigureAwait(false);
var activeStatementSpanProvider = GetActiveStatementSpanProvider(solution);
var (moduleUpdates, diagnosticData, rudeEdits, syntaxError) = await GetDebuggingSession().EmitSolutionUpdateAsync(solution, activeStatementSpanProvider, _diagnosticService, _diagnosticUpdateSource, cancellationToken).ConfigureAwait(false);

// Only store the solution if we have any changes to apply, otherwise CommitUpdatesAsync/DiscardUpdatesAsync won't be called.
if (moduleUpdates.Status == Contracts.ManagedModuleUpdateStatus.Ready)
if (moduleUpdates.Status == ModuleUpdateStatus.Ready)
{
_pendingUpdatedDesignTimeSolution = designTimeSolution;
}

var updates = moduleUpdates.Updates.SelectAsArray(
update => new ManagedHotReloadUpdate(update.Module, update.ILDelta, update.MetadataDelta, update.PdbDelta, update.UpdatedTypes));

var diagnostics = await EmitSolutionUpdateResults.GetHotReloadDiagnosticsAsync(solution, diagnosticData, rudeEdits, syntaxError, cancellationToken).ConfigureAwait(false);

return new ManagedHotReloadUpdates(updates, diagnostics.FromContract());
var diagnostics = await EmitSolutionUpdateResults.GetHotReloadDiagnosticsAsync(solution, diagnosticData, rudeEdits, syntaxError, moduleUpdates.Status, cancellationToken).ConfigureAwait(false);
return new ManagedHotReloadUpdates(moduleUpdates.Updates.FromContract(), diagnostics.FromContract());
}

public async ValueTask<SourceSpan?> GetCurrentActiveStatementPositionAsync(ManagedInstructionId instruction, CancellationToken cancellationToken)
Expand Down
Loading

0 comments on commit d35ab64

Please sign in to comment.