未验证 提交 acaf11bb 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #45793 from sharwell/netcoreapp-unittests-utilities

Update Roslyn.Services.UnitTests.Utilities to target netcoreapp3.1
......@@ -30,7 +30,7 @@
<RoslynDiagnosticsNugetPackageVersion>3.3.0-beta1.20352.4</RoslynDiagnosticsNugetPackageVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>3.3.0-beta1.20352.4</MicrosoftCodeAnalysisNetAnalyzersVersion>
<CodeStyleLayerCodeAnalysisVersion>3.6.0-2.final</CodeStyleLayerCodeAnalysisVersion>
<MicrosoftCodeAnalysisTestingVersion>1.0.1-beta1.20210.2</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftCodeAnalysisTestingVersion>1.0.1-beta1.20358.1</MicrosoftCodeAnalysisTestingVersion>
<CodeStyleAnalyzerVersion>3.7.0-3.20271.4</CodeStyleAnalyzerVersion>
<VisualStudioEditorPackagesVersion>16.4.248</VisualStudioEditorPackagesVersion>
<ILToolsPackageVersion>5.0.0-alpha1.19409.1</ILToolsPackageVersion>
......@@ -108,7 +108,7 @@
<MicrosoftVisualStudioCodeAnalysisSdkUIVersion>15.8.27812-alpha</MicrosoftVisualStudioCodeAnalysisSdkUIVersion>
<MicrosoftVisualStudioCodingConventionsVersion>1.1.20180503.2</MicrosoftVisualStudioCodingConventionsVersion>
<MicrosoftVisualStudioComponentModelHostVersion>16.0.467</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualStudioCompositionVersion>15.6.36</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioCompositionVersion>16.4.11</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioCoreUtilityVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioCoreUtilityVersion>
<MicrosoftVisualStudioDebuggerUIInterfacesVersion>16.4.0-beta.20106.1</MicrosoftVisualStudioDebuggerUIInterfacesVersion>
<MicrosoftVisualStudioDebuggerEngineimplementationVersion>16.5.1122001-preview</MicrosoftVisualStudioDebuggerEngineimplementationVersion>
......
......@@ -145,6 +145,7 @@
<_Dependency Remove="stdole"/>
<_Dependency Remove="StreamJsonRpc"/>
<_Dependency Remove="System.IO.Pipelines"/>
<_Dependency Remove="System.Reflection.TypeExtensions"/>
<_Dependency Remove="System.ValueTuple"/>
<_Dependency Remove="System.Security.AccessControl"/>
<_Dependency Remove="System.Security.Principal.Windows"/>
......
......@@ -48,7 +48,7 @@ protected internal override HostWorkspaceServices CreateWorkspaceServices(Worksp
/// </summary>
public IEnumerable<Lazy<TExtension, TMetadata>> GetExports<TExtension, TMetadata>()
{
var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName, typeof(TMetadata).AssemblyQualifiedName);
var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName!, typeof(TMetadata).AssemblyQualifiedName!);
if (!_exportsMap.TryGetValue(key, out var exports))
{
exports = ImmutableInterlocked.GetOrAdd(ref _exportsMap, key, _ =>
......@@ -65,7 +65,7 @@ protected internal override HostWorkspaceServices CreateWorkspaceServices(Worksp
/// </summary>
public IEnumerable<Lazy<TExtension>> GetExports<TExtension>()
{
var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName, "");
var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName!, "");
if (!_exportsMap.TryGetValue(key, out var exports))
{
exports = ImmutableInterlocked.GetOrAdd(ref _exportsMap, key, _ =>
......@@ -90,7 +90,7 @@ public bool Equals(ExportKey other)
=> string.Compare(ExtensionTypeName, other.ExtensionTypeName, StringComparison.OrdinalIgnoreCase) == 0 &&
string.Compare(MetadataTypeName, other.MetadataTypeName, StringComparison.OrdinalIgnoreCase) == 0;
public override bool Equals(object obj)
public override bool Equals(object? obj)
=> obj is ExportKey key && Equals(key);
public override int GetHashCode()
......
......@@ -27,14 +27,14 @@ static DotNetCoreSdk()
{
var dotNetExeName = "dotnet" + (Path.DirectorySeparatorChar == '/' ? "" : ".exe");
bool DotNetExeExists(string directory)
bool DotNetExeExists(string? directory)
=> directory != null
&& File.Exists(Path.Combine(directory, dotNetExeName));
var dotNetInstallDir = Environment.GetEnvironmentVariable("DOTNET_INSTALL_DIR");
if (!DotNetExeExists(dotNetInstallDir))
{
dotNetInstallDir = Environment.GetEnvironmentVariable("PATH")
dotNetInstallDir = Environment.GetEnvironmentVariable("PATH")!
.Split(Path.PathSeparator)
.FirstOrDefault(DotNetExeExists);
}
......
......@@ -4,12 +4,15 @@
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Options;
#if !NETCOREAPP
using System;
using Roslyn.Utilities;
#endif
namespace Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
{
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.UnitTests</RootNamespace>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<UseWpf>true</UseWpf>
<IsShipping>false</IsShipping>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
......
......@@ -98,7 +98,7 @@ internal void ThrowIfSwitchOccurred()
_failedTransfer.Value.Throw();
}
public override void Post(SendOrPostCallback d, object state)
public override void Post(SendOrPostCallback d, object? state)
{
try
{
......@@ -117,7 +117,7 @@ public override void Post(SendOrPostCallback d, object state)
#pragma warning restore VSTHRD001 // Avoid legacy thread switching APIs
}
public override void Send(SendOrPostCallback d, object state)
public override void Send(SendOrPostCallback d, object? state)
{
try
{
......
......@@ -111,8 +111,8 @@ internal static void ResetThreadAffinity(JoinableTaskFactory joinableTaskFactory
var type = assembly.GetType("Microsoft.VisualStudio.Language.Intellisense.Implementation.ForegroundThreadAffinitizedObject", throwOnError: false);
if (type != null)
{
type.GetField("foregroundThread", BindingFlags.Static | BindingFlags.NonPublic).SetValue(null, thread);
type.GetField("ForegroundTaskScheduler", BindingFlags.Static | BindingFlags.NonPublic).SetValue(null, taskScheduler);
type.GetField("foregroundThread", BindingFlags.Static | BindingFlags.NonPublic)!.SetValue(null, thread);
type.GetField("ForegroundTaskScheduler", BindingFlags.Static | BindingFlags.NonPublic)!.SetValue(null, taskScheduler);
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册