未验证 提交 f9fc5ea4 编写于 作者: D dotnet-automerge-bot 提交者: GitHub

Merge pull request #33119 from dotnet/merges/dev16.0-preview3-to-dev16.0-preview3-vs-deps

Merge dev16.0-preview3 to dev16.0-preview3-vs-deps
......@@ -51,6 +51,8 @@ public void SetOutputFileName(string filename)
{
VisualStudioProject.AssemblyName = Path.GetFileNameWithoutExtension(filename);
}
RefreshBinOutputPath();
}
public void SetOutputFileType(OutputFileType fileType)
......
......@@ -10,7 +10,6 @@
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Experiments;
using Microsoft.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Settings;
using Microsoft.VisualStudio.Shell;
......@@ -26,28 +25,22 @@ namespace Microsoft.VisualStudio.LanguageServices.Experimentation
[TextViewRole(PredefinedTextViewRoles.Analyzable)]
internal class EnhancedColorExperiment : ForegroundThreadAffinitizedObject, IWpfTextViewConnectionListener, IDisposable
{
private const string UseEnhancedColorsFlight = "UseEnhancedColors";
private const string StopEnhancedColorsFlight = "StopEnhancedColors";
private const string UseEnhancedColorsSetting = "WindowManagement.Options.UseEnhancedColorsForManagedLanguages";
private readonly IExperimentationService _experimentationService;
private readonly IServiceProvider _serviceProvider;
private EnhancedColorApplier _colorApplier;
private ISettingsManager _settingsManager;
private bool _isDisposed = false;
private bool _inUseEnhancedColorsFlight;
private bool _inStopEnhancedColorsFlight;
private bool _hasTextViewOpened;
[ImportingConstructor]
[Obsolete]
private EnhancedColorExperiment(IThreadingContext threadingContext, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, VisualStudioExperimentationService experimentationService)
private EnhancedColorExperiment(IThreadingContext threadingContext, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
: base(threadingContext)
{
_serviceProvider = serviceProvider;
_experimentationService = experimentationService;
}
public void Dispose()
......@@ -66,21 +59,11 @@ public void SubjectBuffersConnected(IWpfTextView textView, ConnectionReason reas
_hasTextViewOpened = true;
_colorApplier = new EnhancedColorApplier(_serviceProvider);
// Check which experimental flights we are in
_inUseEnhancedColorsFlight = _experimentationService.IsExperimentEnabled(UseEnhancedColorsFlight);
_inStopEnhancedColorsFlight = _experimentationService.IsExperimentEnabled(StopEnhancedColorsFlight);
_settingsManager = (ISettingsManager)_serviceProvider.GetService(typeof(SVsSettingsPersistenceManager));
// Do not hook settings changed if we have stopped the experiment.
// We will simply remove the enhanced colors if they are applied.
if (!_inStopEnhancedColorsFlight)
{
// We need to update the theme whenever the Preview Setting changes or the VS Theme changes.
_settingsManager.GetSubset(UseEnhancedColorsSetting).SettingChangedAsync += UseEnhancedColorsSettingChangedAsync;
VSColorTheme.ThemeChanged += VSColorTheme_ThemeChanged;
}
// We need to update the theme whenever the Preview Setting changes or the VS Theme changes.
_settingsManager.GetSubset(UseEnhancedColorsSetting).SettingChangedAsync += UseEnhancedColorsSettingChangedAsync;
VSColorTheme.ThemeChanged += VSColorTheme_ThemeChanged;
VsTaskLibraryHelper.CreateAndStartTask(VsTaskLibraryHelper.ServiceInstance, VsTaskRunContext.UIThreadIdlePriority, UpdateThemeColors);
}
......@@ -117,15 +100,13 @@ private void UpdateThemeColors()
var useEnhancedColorsSetting = _settingsManager.GetValueOrDefault(UseEnhancedColorsSetting, defaultValue: 0);
// useEnhancedColorsSetting
// 0 -> use value from flight.
// 1 -> always use enhanced colors (unless the kill flight is active).
// -1 -> never use enhanced colors.
var inEnhancedFlightOrOptIn = _inUseEnhancedColorsFlight || useEnhancedColorsSetting == 1;
var inStopFlightOrOptOut = _inStopEnhancedColorsFlight || useEnhancedColorsSetting == -1;
// 0 -> use enhanced colors.
// 1 -> use enhanced colors.
// -1 -> don't use enhanced colors.
// Try to set colors appropriately. We will only set colors if the user
// has not customized colors and we consider ourselves the color owner.
if (!inStopFlightOrOptOut && inEnhancedFlightOrOptIn)
if (useEnhancedColorsSetting != -1)
{
_colorApplier.TrySetEnhancedColors(currentThemeId);
}
......@@ -246,7 +227,7 @@ public void TrySetEnhancedColors(Guid themeId)
UpdateColorItem(colorItemMap, ClassificationTypeNames.OperatorOverloaded, DarkThemeMethodYellow);
UpdateColorItem(colorItemMap, ClassificationTypeNames.ControlKeyword, DarkThemeControlKeywordPurple);
UpdateColorItem(colorItemMap, ClassificationTypeNames.StructName, DarkThemeStructMint);
UpdateColorItem(colorItemMap, ClassificationTypeNames.StaticSymbol, DefaultForegroundColor, DefaultBackgroundColor, isBold: true);
UpdateColorItem(colorItemMap, ClassificationTypeNames.StaticSymbol, DefaultForegroundColor, DefaultBackgroundColor);
}
else
{
......@@ -257,7 +238,7 @@ public void TrySetEnhancedColors(Guid themeId)
UpdateColorItem(colorItemMap, ClassificationTypeNames.ExtensionMethodName, LightThemeMethodYellow);
UpdateColorItem(colorItemMap, ClassificationTypeNames.OperatorOverloaded, LightThemeMethodYellow);
UpdateColorItem(colorItemMap, ClassificationTypeNames.ControlKeyword, LightThemeControlKeywordPurple);
UpdateColorItem(colorItemMap, ClassificationTypeNames.StaticSymbol, DefaultForegroundColor, DefaultBackgroundColor, isBold: true);
UpdateColorItem(colorItemMap, ClassificationTypeNames.StaticSymbol, DefaultForegroundColor, DefaultBackgroundColor);
}
}
......
......@@ -180,7 +180,7 @@ protected void RemoveFile(string filename)
VisualStudioProject.RemoveSourceFile(filename);
}
private void RefreshBinOutputPath()
protected void RefreshBinOutputPath()
{
var storage = Hierarchy as IVsBuildPropertyStorage;
if (storage == null)
......
......@@ -122,13 +122,11 @@ private static class Connections
await Task.Delay(retry_delayInMS, cancellationToken).ConfigureAwait(false);
}
// crash right away to get better dump. otherwise, we will get dump from async exception
// which most likely lost all valuable data
FatalError.ReportUnlessCanceled(lastException);
GC.KeepAlive(lastException);
RemoteHostCrashInfoBar.ShowInfoBar(workspace);
// unreachable
throw ExceptionUtilities.Unreachable;
// raise soft crash exception rather than doing hard crash.
// we had enough feedback from users not to crash VS on servicehub failure
throw new SoftCrashException("RequestServiceAsync Failed", lastException, cancellationToken);
}
#region code related to make diagnosis easier later
......
......@@ -48,21 +48,32 @@ private enum GlobalNotificationState
public static async Task<RemoteHostClient> CreateAsync(
Workspace workspace, CancellationToken cancellationToken)
{
using (Logger.LogBlock(FunctionId.ServiceHubRemoteHostClient_CreateAsync, cancellationToken))
try
{
var primary = new HubClient("ManagedLanguage.IDE.RemoteHostClient");
var timeout = TimeSpan.FromMilliseconds(workspace.Options.GetOption(RemoteHostOptions.RequestServiceTimeoutInMS));
using (Logger.LogBlock(FunctionId.ServiceHubRemoteHostClient_CreateAsync, cancellationToken))
{
var primary = new HubClient("ManagedLanguage.IDE.RemoteHostClient");
var timeout = TimeSpan.FromMilliseconds(workspace.Options.GetOption(RemoteHostOptions.RequestServiceTimeoutInMS));
// Retry (with timeout) until we can connect to RemoteHost (service hub process).
// we are seeing cases where we failed to connect to service hub process when a machine is under heavy load.
// (see https://devdiv.visualstudio.com/DevDiv/_workitems/edit/481103 as one of example)
var instance = await Connections.RetryRemoteCallAsync<IOException, ServiceHubRemoteHostClient>(
workspace, () => CreateWorkerAsync(workspace, primary, timeout, cancellationToken), timeout, cancellationToken).ConfigureAwait(false);
// Retry (with timeout) until we can connect to RemoteHost (service hub process).
// we are seeing cases where we failed to connect to service hub process when a machine is under heavy load.
// (see https://devdiv.visualstudio.com/DevDiv/_workitems/edit/481103 as one of example)
var instance = await Connections.RetryRemoteCallAsync<IOException, ServiceHubRemoteHostClient>(
workspace, () => CreateWorkerAsync(workspace, primary, timeout, cancellationToken), timeout, cancellationToken).ConfigureAwait(false);
instance.Started();
instance.Started();
// return instance
return instance;
// return instance
return instance;
}
}
catch (SoftCrashException)
{
// at this point, we should have shown info bar (RemoteHostCrashInfoBar.ShowInfoBar) to users
// returning null here will disable OOP for this VS session.
// * Note * this is not trying to recover the exception. but giving users to time
// to clean up before restart VS
return null;
}
}
......
......@@ -317,6 +317,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim
VisualStudioProject.AssemblyName = Path.GetFileNameWithoutExtension(pCompilerOptions.wszExeName)
End If
RefreshBinOutputPath()
_runtimeLibraries = VisualStudioProjectOptionsProcessor.GetRuntimeLibraries(_compilerHost)
If Not _runtimeLibraries.SequenceEqual(oldRuntimeLibraries, StringComparer.Ordinal) Then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册