Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release/dev16.11 to release/dev16.11-vs-deps #54000

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0-preview1.21054.10</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisTestingVersion>1.0.1-beta1.20623.3</MicrosoftCodeAnalysisTestingVersion>
<CodeStyleAnalyzerVersion>3.9.0</CodeStyleAnalyzerVersion>
<VisualStudioEditorPackagesVersion>16.10.44</VisualStudioEditorPackagesVersion>
<VisualStudioEditorPackagesVersion>16.10.230</VisualStudioEditorPackagesVersion>
<ILAsmPackageVersion>5.0.0-alpha1.19409.1</ILAsmPackageVersion>
<ILDAsmPackageVersion>5.0.0-preview.1.20112.8</ILDAsmPackageVersion>
<MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>16.10.161</MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>
<MicrosoftVisualStudioShellPackagesVersion>16.10.0-preview-2-31112-292</MicrosoftVisualStudioShellPackagesVersion>
<MicrosoftVisualStudioShellPackagesVersion>16.10.31320.204</MicrosoftVisualStudioShellPackagesVersion>
<MicrosoftBuildPackagesVersion>16.5.0</MicrosoftBuildPackagesVersion>
<!-- The version of Roslyn we build Source Generators against that are built in this
repository. This must be lower than MicrosoftNetCompilersToolsetVersion,
Expand All @@ -62,8 +62,7 @@
<MicrosoftBuildRuntimeVersion>$(MicrosoftBuildPackagesVersion)</MicrosoftBuildRuntimeVersion>
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildPackagesVersion)</MicrosoftBuildTasksCoreVersion>
<NuGetVisualStudioContractsVersion>5.7.0</NuGetVisualStudioContractsVersion>
<!-- This is working around Microsoft.VisualStudio.Shell.15.0 having an unstated conflicting reference on this with NuGet.VisualStudio.Contracts -->
<MicrosoftVisualStudioRpcContractsVersion>16.10.14-alpha</MicrosoftVisualStudioRpcContractsVersion>
<MicrosoftVisualStudioRpcContractsVersion>16.10.23</MicrosoftVisualStudioRpcContractsVersion>
<!--
Since the Microsoft.CodeAnalysis.Analyzers package is a public dependency of our NuGet
packages we will keep it untied to the RoslynDiagnosticsNugetPackageVersion we use for
Expand Down Expand Up @@ -114,20 +113,20 @@
<MicrosoftNetSdkVersion>2.0.0-alpha-20170405-2</MicrosoftNetSdkVersion>
<MicrosoftNuGetBuildTasksVersion>0.1.0</MicrosoftNuGetBuildTasksVersion>
<MicrosoftPortableTargetsVersion>0.1.2-dev</MicrosoftPortableTargetsVersion>
<MicrosoftServiceHubClientVersion>2.7.454</MicrosoftServiceHubClientVersion>
<MicrosoftServiceHubFrameworkVersion>2.7.454</MicrosoftServiceHubFrameworkVersion>
<MicrosoftServiceHubClientVersion>2.8.10</MicrosoftServiceHubClientVersion>
<MicrosoftServiceHubFrameworkVersion>2.8.10</MicrosoftServiceHubFrameworkVersion>
<MicrosoftVisualBasicVersion>10.1.0</MicrosoftVisualBasicVersion>
<MicrosoftVisualStudioCacheVersion>16.10.40-alpha</MicrosoftVisualStudioCacheVersion>
<MicrosoftVisualStudioCallHierarchyPackageDefinitionsVersion>15.8.27812-alpha</MicrosoftVisualStudioCallHierarchyPackageDefinitionsVersion>
<MicrosoftVisualStudioCodeAnalysisSdkUIVersion>15.8.27812-alpha</MicrosoftVisualStudioCodeAnalysisSdkUIVersion>
<MicrosoftVisualStudioComponentModelHostVersion>16.10.44</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualStudioCompositionVersion>16.5.13</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioComponentModelHostVersion>16.10.230</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualStudioCompositionVersion>16.9.20</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioCoreUtilityVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioCoreUtilityVersion>
<MicrosoftVisualStudioDebuggerUIInterfacesVersion>16.10.0-beta.21214.1</MicrosoftVisualStudioDebuggerUIInterfacesVersion>
<MicrosoftVisualStudioDebuggerContractsVersion>16.10.0-beta.21214.1</MicrosoftVisualStudioDebuggerContractsVersion>
<MicrosoftVisualStudioDebuggerEngineimplementationVersion>16.5.1122001-preview</MicrosoftVisualStudioDebuggerEngineimplementationVersion>
<MicrosoftVisualStudioDebuggerMetadataimplementationVersion>16.5.1122001-preview</MicrosoftVisualStudioDebuggerMetadataimplementationVersion>
<MicrosoftVisualStudioDesignerInterfacesVersion>16.10.0-preview-2-31112-292</MicrosoftVisualStudioDesignerInterfacesVersion>
<MicrosoftVisualStudioDesignerInterfacesVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioDesignerInterfacesVersion>
<MicrosoftVisualStudioDiagnosticsPerformanceProviderVersion>16.0.28226-alpha</MicrosoftVisualStudioDiagnosticsPerformanceProviderVersion>
<MicrosoftVisualStudioSDKEmbedInteropTypesVersion>15.0.36</MicrosoftVisualStudioSDKEmbedInteropTypesVersion>
<MicrosoftVisualStudioEditorVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioEditorVersion>
Expand All @@ -154,7 +153,7 @@
<MicrosoftVisualStudioProjectSystemVersion>16.2.133-pre</MicrosoftVisualStudioProjectSystemVersion>
<MicrosoftVisualStudioProjectSystemManagedVersion>2.3.6152103</MicrosoftVisualStudioProjectSystemManagedVersion>
<MicrosoftVisualStudioRemoteControlVersion>16.3.32</MicrosoftVisualStudioRemoteControlVersion>
<MicrosoftVisualStudioSDKAnalyzersVersion>16.9.2-alpha</MicrosoftVisualStudioSDKAnalyzersVersion>
<MicrosoftVisualStudioSDKAnalyzersVersion>16.10.1</MicrosoftVisualStudioSDKAnalyzersVersion>
<MicrosoftVisualStudioSetupConfigurationInteropVersion>1.16.30</MicrosoftVisualStudioSetupConfigurationInteropVersion>
<MicrosoftVisualStudioShell150Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShell150Version>
<MicrosoftVisualStudioShellFrameworkVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellFrameworkVersion>
Expand All @@ -169,7 +168,7 @@
<MicrosoftVisualStudioShellInterop169DesignTimeVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellInterop169DesignTimeVersion>
<MicrosoftVisualStudioShellInterop80Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellInterop80Version>
<MicrosoftVisualStudioShellInterop90Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellInterop90Version>
<MicrosoftVisualStudioTelemetryVersion>16.3.109</MicrosoftVisualStudioTelemetryVersion>
<MicrosoftVisualStudioTelemetryVersion>16.3.176</MicrosoftVisualStudioTelemetryVersion>
<MicrosoftVisualStudioTemplateWizardInterfaceVersion>8.0.0.0-alpha</MicrosoftVisualStudioTemplateWizardInterfaceVersion>
<MicrosoftVisualStudioTextDataVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioTextDataVersion>
<MicrosoftVisualStudioTextInternalVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioTextInternalVersion>
Expand All @@ -182,10 +181,10 @@
<MicrosoftVisualStudioTextManagerInterop120Version>12.0.30110</MicrosoftVisualStudioTextManagerInterop120Version>
<MicrosoftVisualStudioTextManagerInterop121DesignTimeVersion>12.1.30328</MicrosoftVisualStudioTextManagerInterop121DesignTimeVersion>
<MicrosoftVisualStudioTextManagerInterop160DesignTimeVersion>16.0.0</MicrosoftVisualStudioTextManagerInterop160DesignTimeVersion>
<MicrosoftVisualStudioThreadingAnalyzersVersion>16.10.41-alpha</MicrosoftVisualStudioThreadingAnalyzersVersion>
<MicrosoftVisualStudioThreadingVersion>16.10.41-alpha</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioThreadingAnalyzersVersion>16.10.56</MicrosoftVisualStudioThreadingAnalyzersVersion>
<MicrosoftVisualStudioThreadingVersion>16.10.56</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioUtilitiesVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioUtilitiesVersion>
<MicrosoftVisualStudioValidationVersion>16.9.30</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioValidationVersion>16.10.26</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioVsInteractiveWindowVersion>2.8.0</MicrosoftVisualStudioVsInteractiveWindowVersion>
<MicrosoftVisualStudioWorkspaceVSIntegrationVersion>16.3.43</MicrosoftVisualStudioWorkspaceVSIntegrationVersion>
<MicrosoftWin32PrimitivesVersion>4.3.0</MicrosoftWin32PrimitivesVersion>
Expand All @@ -194,7 +193,7 @@
<MDbgVersion>0.1.0</MDbgVersion>
<MonoOptionsVersion>6.6.0.161</MonoOptionsVersion>
<MoqVersion>4.10.1</MoqVersion>
<NerdbankStreamsVersion>2.6.81</NerdbankStreamsVersion>
<NerdbankStreamsVersion>2.7.74</NerdbankStreamsVersion>
<NuGetVisualStudioVersion>4.0.0-rc-2048</NuGetVisualStudioVersion>
<NuGetSolutionRestoreManagerInteropVersion>4.8.0</NuGetSolutionRestoreManagerInteropVersion>
<MicrosoftDiaSymReaderPdb2PdbVersion>1.1.0-beta1-62506-02</MicrosoftDiaSymReaderPdb2PdbVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal class CompilationAvailableTaggerEventSource : ITaggerEventSource
/// <summary>
/// Cancellation tokens controlling background computation of the compilation.
/// </summary>
private readonly CancellationSeries _cancellationSeries = new();
private readonly ReferenceCountedDisposable<CancellationSeries> _cancellationSeries = new(new CancellationSeries());

public CompilationAvailableTaggerEventSource(
ITextBuffer subjectBuffer,
Expand Down Expand Up @@ -72,9 +72,16 @@ private void OnEventSourceChanged(object? sender, TaggerEventArgs args)
if (!document.SupportsSemanticModel)
return;

using var cancellationSeries = _cancellationSeries.TryAddReference();
if (cancellationSeries is null)
{
// Already in the process of disposing this instance
return;
}

// Cancel any existing tasks that are computing the compilation and spawn a new one to compute
// it and notify any listening clients.
var cancellationToken = _cancellationSeries.CreateNext();
var cancellationToken = cancellationSeries.Target.CreateNext();

var token = _asyncListener.BeginAsyncOperation(nameof(OnEventSourceChanged));
var task = Task.Run(async () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ private sealed partial class TagSource : ForegroundThreadAffinitizedObject
/// </summary>
private readonly IAsynchronousOperationListener _asyncListener;

private readonly CancellationTokenSource _disposalTokenSource = new();
private readonly CancellationTokenSource _disposalTokenSource;
private readonly CancellationToken _disposalToken;

/// <summary>
/// Work queue that collects event notifications and kicks off the work to process them.
Expand All @@ -69,7 +70,7 @@ private sealed partial class TagSource : ForegroundThreadAffinitizedObject
/// Series of tokens used to cancel previous outstanding work when new work comes in. Also used as the lock
/// to ensure threadsafe writing of _eventWorkQueue.
/// </summary>
private readonly CancellationSeries _cancellationSeries;
private readonly ReferenceCountedDisposable<CancellationSeries> _cancellationSeries;

/// <summary>
/// Work queue that collects high priority requests to call TagsChanged with.
Expand Down Expand Up @@ -121,19 +122,22 @@ public TagSource(
if (dataSource.SpanTrackingMode == SpanTrackingMode.Custom)
throw new ArgumentException("SpanTrackingMode.Custom not allowed.", "spanTrackingMode");

_disposalTokenSource = new CancellationTokenSource();
_disposalToken = _disposalTokenSource.Token;

_subjectBuffer = subjectBuffer;
_textViewOpt = textViewOpt;
_dataSource = dataSource;
_asyncListener = asyncListener;

_cancellationSeries = new CancellationSeries(_disposalTokenSource.Token);
_cancellationSeries = new ReferenceCountedDisposable<CancellationSeries>(new CancellationSeries(_disposalToken));

_highPriTagsChangedQueue = new AsyncBatchingWorkQueue<NormalizedSnapshotSpanCollection>(
TaggerDelay.NearImmediate.ComputeTimeDelay(),
ProcessTagsChangedAsync,
equalityComparer: null,
asyncListener,
_disposalTokenSource.Token);
_disposalToken);

if (_dataSource.AddedTagNotificationDelay == TaggerDelay.NearImmediate)
{
Expand All @@ -148,7 +152,7 @@ public TagSource(
ProcessTagsChangedAsync,
equalityComparer: null,
asyncListener,
_disposalTokenSource.Token);
_disposalToken);
}

DebugRecordInitialStackTrace();
Expand Down Expand Up @@ -199,6 +203,7 @@ private void Dispose()

// Stop computing any initial tags if we've been asked for them.
_disposalTokenSource.Cancel();
_disposalTokenSource.Dispose();
_cancellationSeries.Dispose();

_disposed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,34 +170,34 @@ private void OnEventSourceChanged(object? _1, TaggerEventArgs _2)

private void EnqueueWork(bool initialTags)
{
using var cancellationSeries = _cancellationSeries.TryAddReference();
if (cancellationSeries is null)
{
// Already in the process of disposing
return;
}

lock (_cancellationSeries)
{
try
{
// cancel the last piece of computation work and enqueue the next. This doesn't apply for the very
// first tag request we make. We don't want that to be cancellable as we want that result to be
// shown as soon as possible.
var cancellationToken = initialTags ? _disposalTokenSource.Token : _cancellationSeries.CreateNext();

// Continue after the preceeding task unilaterally. Note that we pass LazyCancellation so that
// we still wait for that task to complete even if cancelled before we proceed. This is necessary
// as that prior task may mutate state (even if cancelled) so we cannot proceed until we know it
// is completely done.
_eventWorkQueue = _eventWorkQueue.ContinueWithAfterDelayFromAsync(
async _ =>
{
await this.ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
await RecomputeTagsForegroundAsync(initialTags, cancellationToken).ConfigureAwait(false);
},
cancellationToken,
(int)_dataSource.EventChangeDelay.ComputeTimeDelay().TotalMilliseconds,
TaskContinuationOptions.None,
TaskScheduler.Default).CompletesAsyncOperation(_asyncListener.BeginAsyncOperation(nameof(EnqueueWork)));
}
catch (ObjectDisposedException)
{
// can happen if our type was disposed and we try to get a new token from _cancellationSeries.
}
// cancel the last piece of computation work and enqueue the next. This doesn't apply for the very
// first tag request we make. We don't want that to be cancellable as we want that result to be
// shown as soon as possible.
var cancellationToken = initialTags ? _disposalToken : cancellationSeries.Target.CreateNext();

// Continue after the preceeding task unilaterally. Note that we pass LazyCancellation so that
// we still wait for that task to complete even if cancelled before we proceed. This is necessary
// as that prior task may mutate state (even if cancelled) so we cannot proceed until we know it
// is completely done.
_eventWorkQueue = _eventWorkQueue.ContinueWithAfterDelayFromAsync(
async _ =>
{
await this.ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
await RecomputeTagsForegroundAsync(initialTags, cancellationToken).ConfigureAwait(false);
},
cancellationToken,
(int)_dataSource.EventChangeDelay.ComputeTimeDelay().TotalMilliseconds,
TaskContinuationOptions.None,
TaskScheduler.Default).CompletesAsyncOperation(_asyncListener.BeginAsyncOperation(nameof(EnqueueWork)));
}
}

Expand Down Expand Up @@ -530,7 +530,7 @@ private static DiffResult ComputeDifference(
!this.CachedTagTrees.TryGetValue(buffer, out _))
{
this.ThreadingContext.JoinableTaskFactory.Run(() =>
this.RecomputeTagsForegroundAsync(initialTags: true, _disposalTokenSource.Token));
this.RecomputeTagsForegroundAsync(initialTags: true, _disposalToken));
}

_firstTagsRequest = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void TestAllPredefinedNamesUsedAsNameMetadata(Type providerType, Type pre
private static bool TryGetExportName(ExportDefinition export, [NotNullWhen(returnValue: true)] out string? name)
{
if (!export.Metadata.TryGetValue("Name", out var nameObj)
|| nameObj is string { Length: 0 })
|| nameObj is not string { Length: > 0 })
{
name = null;
return false;
Expand Down Expand Up @@ -179,7 +179,7 @@ private static ImmutableHashSet<string> GetPredefinedNamesFromType(Type namesTyp
string language)
{
return FindComposedPartsWithExport(configuration, exportedTypeName)
.Where(part => ((string[])part.Export.Metadata["Languages"]).Contains(language));
.Where(part => ((string[])part.Export.Metadata["Languages"]!).Contains(language));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<PackageReference Include="Microsoft.VisualStudio.SDK.Analyzers" Version="$(MicrosoftVisualStudioSDKAnalyzersVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(MicrosoftVisualStudioShell150Version)" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="$(MicrosoftVisualStudioValidationVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
<PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" />
</ItemGroup>
Expand Down
Loading