未验证 提交 7db0e23c 编写于 作者: M msftbot[bot] 提交者: GitHub

Merge pull request #46234 from dotnet/merges/master-to-master-vs-deps

Merge master to master-vs-deps
......@@ -20,7 +20,7 @@ The minimal required version of .NET Framework is 4.7.2.
- Ensure Visual Studio is on Version "16.5" or greater
- Ensure "Use previews of the .NET Core SDK" is checked in Tools -> Options -> Environment -> Preview Features
- Restart Visual Studio
1. [.NET Core SDK 3.1](https://dotnet.microsoft.com/download/dotnet-core/3.0) [Windows x64 installer](https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.100-windows-x64-installer)
1. [.NET Core SDK 5.0 Preview 7](https://dotnet.microsoft.com/download/dotnet-core/5.0) [Windows x64 installer](https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.100-preview.7-windows-x64-installer)
1. [PowerShell 5.0 or newer](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell). If you are on Windows 10, you are fine; you'll only need to upgrade if you're on earlier versions of Windows. The download link is under the ["Upgrading existing Windows PowerShell"](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell) heading.
1. Run Restore.cmd
1. Open Roslyn.sln
......
......@@ -64,7 +64,7 @@
<MicrosoftCodeAnalysisCSharpCodeRefactoringTestingXUnitVersion>$(MicrosoftCodeAnalysisTestingVersion)</MicrosoftCodeAnalysisCSharpCodeRefactoringTestingXUnitVersion>
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>$(CodeStyleAnalyzerVersion)</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisElfieVersion>0.10.6</MicrosoftCodeAnalysisElfieVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.36</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.41</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
<MicrosoftCodeAnalysisVisualBasicCodeFixTestingXUnitVersion>$(MicrosoftCodeAnalysisTestingVersion)</MicrosoftCodeAnalysisVisualBasicCodeFixTestingXUnitVersion>
<MicrosoftCodeAnalysisVisualBasicCodeRefactoringTestingXUnitVersion>$(MicrosoftCodeAnalysisTestingVersion)</MicrosoftCodeAnalysisVisualBasicCodeRefactoringTestingXUnitVersion>
<MicrosoftCodeAnalysisVisualBasicCodeStyleVersion>$(CodeStyleAnalyzerVersion)</MicrosoftCodeAnalysisVisualBasicCodeStyleVersion>
......@@ -175,7 +175,7 @@
<MicrosoftVisualStudioWorkspaceVSIntegrationVersion>16.3.43</MicrosoftVisualStudioWorkspaceVSIntegrationVersion>
<MicrosoftWin32PrimitivesVersion>4.3.0</MicrosoftWin32PrimitivesVersion>
<MicrosoftWin32RegistryVersion>4.7.0</MicrosoftWin32RegistryVersion>
<MSBuildStructuredLoggerVersion>2.0.61</MSBuildStructuredLoggerVersion>
<MSBuildStructuredLoggerVersion>2.1.133</MSBuildStructuredLoggerVersion>
<MDbgVersion>0.1.0</MDbgVersion>
<MonoOptionsVersion>4.4.0</MonoOptionsVersion>
<MoqVersion>4.10.1</MoqVersion>
......
......@@ -170,7 +170,7 @@
<!-- VB specific settings -->
<When Condition="'$(Language)' == 'VB'">
<PropertyGroup>
<LangVersion>15.5</LangVersion>
<LangVersion>16</LangVersion>
<NoWarn>$(NoWarn);40057</NoWarn>
<VBRuntime>Embed</VBRuntime>
</PropertyGroup>
......
{
"sdk": {
"version": "5.0.100-preview.7.20366.6",
"allowPrerelease": true,
"rollForward": "major"
},
"tools": {
"dotnet": "3.1.200",
"dotnet": "5.0.100-preview.7.20366.6",
"vs": {
"version": "16.4"
"version": "16.6"
},
"xcopy-msbuild": "16.4.0-alpha"
"xcopy-msbuild": "16.6.5-alpha1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20365.6"
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Generic;
using System.Linq;
using System.Threading;
......@@ -47,18 +49,18 @@ protected override bool CanExplicitInterfaceImplementationsBeFixed()
MemberDeclarationSyntax member,
List<AnalysisResult> analysisResults)
{
if (member.IsKind(SyntaxKind.NamespaceDeclaration, out NamespaceDeclarationSyntax namespaceDeclaration))
if (member.IsKind(SyntaxKind.NamespaceDeclaration, out NamespaceDeclarationSyntax? namespaceDeclaration))
{
AnalyzeMembers(context, namespaceDeclaration.Members, analysisResults);
}
else if (member.IsKind(SyntaxKind.ClassDeclaration, out TypeDeclarationSyntax typeDeclaration) ||
else if (member.IsKind(SyntaxKind.ClassDeclaration, out TypeDeclarationSyntax? typeDeclaration) ||
member.IsKind(SyntaxKind.StructDeclaration, out typeDeclaration) ||
member.IsKind(SyntaxKindEx.RecordDeclaration, out typeDeclaration))
{
// If we have a class or struct, recurse inwards.
AnalyzeMembers(context, typeDeclaration.Members, analysisResults);
}
else if (member.IsKind(SyntaxKind.PropertyDeclaration, out PropertyDeclarationSyntax propertyDeclaration))
else if (member.IsKind(SyntaxKind.PropertyDeclaration, out PropertyDeclarationSyntax? propertyDeclaration))
{
AnalyzeProperty(context, propertyDeclaration, analysisResults);
}
......@@ -68,7 +70,7 @@ protected override bool CanExplicitInterfaceImplementationsBeFixed()
List<AnalysisResult> analysisResults, HashSet<IFieldSymbol> ineligibleFields,
Compilation compilation, CancellationToken cancellationToken)
{
var groups = analysisResults.Select(r => (typeDeclaration: (TypeDeclarationSyntax)r.PropertyDeclaration.Parent, r.SemanticModel))
var groups = analysisResults.Select(r => (typeDeclaration: (TypeDeclarationSyntax)r.PropertyDeclaration.Parent!, r.SemanticModel))
.Distinct()
.GroupBy(n => n.typeDeclaration.SyntaxTree);
......@@ -94,7 +96,7 @@ protected override bool CanExplicitInterfaceImplementationsBeFixed()
}
}
protected override ExpressionSyntax GetFieldInitializer(
protected override ExpressionSyntax? GetFieldInitializer(
VariableDeclaratorSyntax variable, CancellationToken cancellationToken)
{
return variable.Initializer?.Value;
......@@ -111,7 +113,7 @@ protected override bool CanExplicitInterfaceImplementationsBeFixed()
AddIneligibleField(symbol);
}
void AddIneligibleField(ISymbol symbol)
void AddIneligibleField(ISymbol? symbol)
{
if (symbol is IFieldSymbol field)
{
......@@ -122,7 +124,7 @@ void AddIneligibleField(ISymbol symbol)
private static bool CheckExpressionSyntactically(ExpressionSyntax expression)
{
if (expression.IsKind(SyntaxKind.SimpleMemberAccessExpression, out MemberAccessExpressionSyntax memberAccessExpression))
if (expression.IsKind(SyntaxKind.SimpleMemberAccessExpression, out MemberAccessExpressionSyntax? memberAccessExpression))
{
return memberAccessExpression.Expression.Kind() == SyntaxKind.ThisExpression &&
memberAccessExpression.Name.Kind() == SyntaxKind.IdentifierName;
......@@ -135,7 +137,7 @@ private static bool CheckExpressionSyntactically(ExpressionSyntax expression)
return false;
}
protected override ExpressionSyntax GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken)
protected override ExpressionSyntax? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken)
{
// Getter has to be of the form:
// 1. Getter can be defined as accessor or expression bodied lambda
......@@ -154,7 +156,7 @@ protected override ExpressionSyntax GetGetterExpression(IMethodSymbol getMethod,
return CheckExpressionSyntactically(expr) ? expr : null;
}
private static ExpressionSyntax GetGetterExpressionFromSymbol(IMethodSymbol getMethod, CancellationToken cancellationToken)
private static ExpressionSyntax? GetGetterExpressionFromSymbol(IMethodSymbol getMethod, CancellationToken cancellationToken)
{
var declaration = getMethod.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken);
switch (declaration)
......@@ -169,7 +171,7 @@ private static ExpressionSyntax GetGetterExpressionFromSymbol(IMethodSymbol getM
}
}
private static T GetSingleStatementFromAccessor<T>(AccessorDeclarationSyntax accessorDeclaration) where T : StatementSyntax
private static T? GetSingleStatementFromAccessor<T>(AccessorDeclarationSyntax? accessorDeclaration) where T : StatementSyntax
{
var statements = accessorDeclaration?.Body?.Statements;
if (statements?.Count == 1)
......@@ -181,7 +183,7 @@ private static ExpressionSyntax GetGetterExpressionFromSymbol(IMethodSymbol getM
return null;
}
protected override ExpressionSyntax GetSetterExpression(
protected override ExpressionSyntax? GetSetterExpression(
IMethodSymbol setMethod, SemanticModel semanticModel, CancellationToken cancellationToken)
{
// Setter has to be of the form:
......@@ -205,7 +207,7 @@ private static ExpressionSyntax GetGetterExpressionFromSymbol(IMethodSymbol getM
return null;
}
private static ExpressionSyntax GetExpressionFromSetter(AccessorDeclarationSyntax setAccessor)
private static ExpressionSyntax? GetExpressionFromSetter(AccessorDeclarationSyntax? setAccessor)
=> setAccessor?.ExpressionBody?.Expression ??
GetSingleStatementFromAccessor<ExpressionStatementSyntax>(setAccessor)?.Expression;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
......@@ -13,7 +15,10 @@
namespace Microsoft.CodeAnalysis.UseAutoProperty
{
internal abstract class AbstractUseAutoPropertyAnalyzer<
TPropertyDeclaration, TFieldDeclaration, TVariableDeclarator, TExpression> : AbstractBuiltInCodeStyleDiagnosticAnalyzer
TPropertyDeclaration,
TFieldDeclaration,
TVariableDeclarator,
TExpression> : AbstractBuiltInCodeStyleDiagnosticAnalyzer
where TPropertyDeclaration : SyntaxNode
where TFieldDeclaration : SyntaxNode
where TVariableDeclarator : SyntaxNode
......@@ -34,9 +39,9 @@ protected AbstractUseAutoPropertyAnalyzer()
protected abstract bool SupportsReadOnlyProperties(Compilation compilation);
protected abstract bool SupportsPropertyInitializer(Compilation compilation);
protected abstract bool CanExplicitInterfaceImplementationsBeFixed();
protected abstract TExpression GetFieldInitializer(TVariableDeclarator variable, CancellationToken cancellationToken);
protected abstract TExpression GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken);
protected abstract TExpression GetSetterExpression(IMethodSymbol setMethod, SemanticModel semanticModel, CancellationToken cancellationToken);
protected abstract TExpression? GetFieldInitializer(TVariableDeclarator variable, CancellationToken cancellationToken);
protected abstract TExpression? GetGetterExpression(IMethodSymbol getMethod, CancellationToken cancellationToken);
protected abstract TExpression? GetSetterExpression(IMethodSymbol setMethod, SemanticModel semanticModel, CancellationToken cancellationToken);
protected abstract SyntaxNode GetNodeToFade(TFieldDeclaration fieldDeclaration, TVariableDeclarator variableDeclarator);
protected abstract void RegisterIneligibleFieldsAction(
......@@ -213,7 +218,7 @@ private void AnalyzeSemanticModel(SemanticModelAnalysisContext context)
return;
}
if (!(variableDeclarator?.Parent?.Parent is TFieldDeclaration fieldDeclaration))
if (!(variableDeclarator.Parent?.Parent is TFieldDeclaration fieldDeclaration))
{
return;
}
......@@ -230,26 +235,27 @@ private void AnalyzeSemanticModel(SemanticModelAnalysisContext context)
}
// Looks like a viable property/field to convert into an auto property.
analysisResults.Add(new AnalysisResult(property, getterField, propertyDeclaration,
fieldDeclaration, variableDeclarator, semanticModel, property.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)));
analysisResults.Add(new AnalysisResult(
property, getterField, propertyDeclaration, fieldDeclaration, variableDeclarator, semanticModel,
property.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)));
}
protected virtual bool CanConvert(IPropertySymbol property)
=> true;
private IFieldSymbol GetSetterField(
private IFieldSymbol? GetSetterField(
SemanticModel semanticModel, IMethodSymbol setMethod, CancellationToken cancellationToken)
{
return CheckFieldAccessExpression(semanticModel, GetSetterExpression(setMethod, semanticModel, cancellationToken));
}
private IFieldSymbol GetGetterField(
private IFieldSymbol? GetGetterField(
SemanticModel semanticModel, IMethodSymbol getMethod, CancellationToken cancellationToken)
{
return CheckFieldAccessExpression(semanticModel, GetGetterExpression(getMethod, cancellationToken));
}
private static IFieldSymbol CheckFieldAccessExpression(SemanticModel semanticModel, TExpression expression)
private static IFieldSymbol? CheckFieldAccessExpression(SemanticModel semanticModel, TExpression? expression)
{
if (expression == null)
{
......@@ -310,7 +316,8 @@ private void Process(AnalysisResult result, SemanticModelAnalysisContext context
// an auto property. For each diagnostic store both location so we can easily retrieve
// them when performing the code fix.
var additionalLocations = ImmutableArray.Create(
propertyDeclaration.GetLocation(), variableDeclarator.GetLocation());
propertyDeclaration.GetLocation(),
variableDeclarator.GetLocation());
var option = context.GetOption(CodeStyleOptions2.PreferAutoProperties, propertyDeclaration.Language);
if (option.Notification.Severity == ReportDiagnostic.Suppress)
......
......@@ -23,6 +23,7 @@
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.DiaSymReader;
......@@ -4130,7 +4131,7 @@ public void AppConfigBasic()
</runtime>
</configuration>");
var silverlight = Temp.CreateFile().WriteAllBytes(TestResources.NetFX.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
var silverlight = Temp.CreateFile().WriteAllBytes(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
var net4_0dll = Temp.CreateFile().WriteAllBytes(ResourcesNet451.System).Path;
// Test linking two appconfig dlls with simple src
......@@ -11101,12 +11102,13 @@ public void MissingCompilerAssembly()
#if NET472
[ConditionalFact(typeof(WindowsDesktopOnly), typeof(IsEnglishLocal), Reason = "https://github.com/dotnet/roslyn/issues/30321")]
public void LoadingAnalyzerNetStandard13()
public void LoadinganalyzerNetStandard13()
{
var analyzerFileName = "AnalyzerNS13.dll";
var srcFileName = "src.cs";
var analyzerDir = Temp.CreateDirectory();
var analyzerFile = analyzerDir.CreateFile(analyzerFileName).WriteAllBytes(DesktopTestHelpers.CreateCSharpAnalyzerNetStandard13(Path.GetFileNameWithoutExtension(analyzerFileName)));
var srcFile = analyzerDir.CreateFile(srcFileName).WriteAllText("public class C { }");
......@@ -11123,6 +11125,7 @@ at Microsoft.CodeAnalysis.Diagnostics.AnalyzerManager.AnalyzerExecutionContext.<
Assert.Equal(0, result.ExitCode);
}
#endif
[WorkItem(406649, "https://devdiv.visualstudio.com/DevDiv/_workitems?id=484417")]
[ConditionalFact(typeof(WindowsDesktopOnly), typeof(IsEnglishLocal), Reason = "https://github.com/dotnet/roslyn/issues/30321")]
public void MicrosoftDiaSymReaderNativeAltLoadPath()
......
......@@ -9,6 +9,7 @@
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
......@@ -74,7 +75,7 @@ public void AppConfigCsc()
</runtime>
</configuration>").Path;
var silverlight = Temp.CreateFile().WriteAllBytes(TestResources.NetFX.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
var silverlight = Temp.CreateFile().WriteAllBytes(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
var net4_0dll = Temp.CreateFile().WriteAllBytes(ResourcesNet451.System).Path;
var outWriter = new StringWriter(CultureInfo.InvariantCulture);
......
......@@ -7565,7 +7565,7 @@ static void Handler()
comp.VerifyDiagnostics();
}
[ConditionalFact(typeof(WindowsOnly), Reason = ConditionalSkipReason.TestExecutionNeedsDesktopTypes)]
[ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.WinRTNeedsWindowsDesktop)]
[WorkItem(16962, "https://github.com/dotnet/roslyn/issues/16962")]
public void Events_03()
{
......@@ -7612,7 +7612,7 @@ static void Handler()
Assert.True(comp2.Compilation.GetMember<IEventSymbol>("C.E").IsWindowsRuntimeEvent);
}
[ConditionalFact(typeof(WindowsOnly), Reason = ConditionalSkipReason.TestExecutionNeedsDesktopTypes)]
[ConditionalFact(typeof(WindowsDesktopOnly), Reason = ConditionalSkipReason.WinRTNeedsWindowsDesktop)]
[WorkItem(16962, "https://github.com/dotnet/roslyn/issues/16962")]
public void Events_04()
{
......
......@@ -10,6 +10,7 @@
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
......@@ -15102,7 +15103,7 @@ static void Main()
}
}";
var testReference = AssemblyMetadata.CreateFromImage(TestResources.Repros.BadDefaultParameterValue).GetReference();
var testReference = AssemblyMetadata.CreateFromImage(ProprietaryTestResources.Repros.BadDefaultParameterValue).GetReference();
var compilation = CompileAndVerify(source, references: new[] { testReference });
compilation.VerifyIL("Program.Main", @"
{
......
......@@ -11,6 +11,7 @@
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Roslyn.Utilities;
......@@ -23,7 +24,7 @@ public class WinMdDumpTest : CSharpTestBase
private readonly MetadataReference _windowsRef = MetadataReference.CreateFromImage(TestResources.WinRt.Windows.AsImmutableOrNull());
private readonly MetadataReference _systemRuntimeRef = MetadataReference.CreateFromImage(TestMetadata.ResourcesNet451.SystemRuntime.AsImmutableOrNull());
private readonly MetadataReference _systemObjectModelRef = MetadataReference.CreateFromImage(TestMetadata.ResourcesNet451.SystemObjectModel.AsImmutableOrNull());
private readonly MetadataReference _windowsRuntimeUIXamlRef = MetadataReference.CreateFromImage(TestResources.NetFX.v4_0_30319_17929.System_Runtime_WindowsRuntime_UI_Xaml.AsImmutableOrNull());
private readonly MetadataReference _windowsRuntimeUIXamlRef = MetadataReference.CreateFromImage(ProprietaryTestResources.v4_0_30319_17929.System_Runtime_WindowsRuntime_UI_Xaml.AsImmutableOrNull());
private readonly MetadataReference _interopServicesWindowsRuntimeRef = MetadataReference.CreateFromImage(TestMetadata.ResourcesNet451.SystemRuntimeInteropServicesWindowsRuntime.AsImmutableOrNull());
private void AppendMembers(StringBuilder result, NamespaceOrTypeSymbol container, string indent)
......
......@@ -4,11 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<!--
Disable on Linux. See https://github.com/dotnet/roslyn/pull/31026
-->
<SkipTests Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(OS)' != 'Windows_NT'">true</SkipTests>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Test\Utilities\Portable\Roslyn.Test.Utilities.csproj" />
......
......@@ -22,9 +22,13 @@ public void TestSourceLink()
var root1 = Path.GetFullPath(ProjectDir.Path + Path.DirectorySeparatorChar);
var root2 = Path.GetFullPath(sourcePackageDir.Path + Path.DirectorySeparatorChar);
var root3 = Environment.GetEnvironmentVariable("NUGET_PACKAGES");
root3 ??= Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".nuget", "packages");
root3 += Path.DirectorySeparatorChar;
var escapedRoot1 = root1.Replace(",", ",,").Replace("=", "==");
var escapedRoot2 = root2.Replace(",", ",,").Replace("=", "==");
var escapedRoot3 = root3.Replace(",", ",,").Replace("=", "==");
var sourceLinkJsonPath = Path.Combine(ObjDir.Path, ProjectName + ".sourcelink.json");
......@@ -85,17 +89,19 @@ public void TestSourceLink()
},
expectedResults: new[]
{
$@"{root2}: /_1/",
$@"{root3}: /_1/",
$@"{root2}: /_2/",
$@"{root1}: /_/",
$@"{root1}sub1{Path.DirectorySeparatorChar}: /_/sub1/",
$@"{root1}sub2{Path.DirectorySeparatorChar}: /_/sub2/",
"true",
$@"{escapedRoot2}=/_1/,{escapedRoot1}=/_/,PreviousPathMap",
$@"{escapedRoot3}=/_1/,{escapedRoot2}=/_2/,{escapedRoot1}=/_/,PreviousPathMap",
"true"
});
AssertEx.AssertEqualToleratingWhitespaceDifferences(
"[/_1/]=[https://raw.githubusercontent.com/Source/Package/*]," +
"[/_1/]=[]," +
"[/_2/]=[https://raw.githubusercontent.com/Source/Package/*]," +
"[/_/]=[https://raw.githubusercontent.com/R1/*]," +
"[/_/sub1/]=[https://raw.githubusercontent.com/M1/*]," +
"[/_/sub2/]=[https://raw.githubusercontent.com/M2/*]",
......@@ -123,6 +129,7 @@ public void TestSourceLink()
},
expectedResults: new[]
{
$@"{root3}: {root3}",
$@"{root2}: {root2}",
$@"{root1}: {root1}",
$@"{root1}sub1{Path.DirectorySeparatorChar}: {root1}sub1{Path.DirectorySeparatorChar}",
......@@ -132,6 +139,7 @@ public void TestSourceLink()
});
AssertEx.AssertEqualToleratingWhitespaceDifferences(
$@"[{root3}]=[]," +
$@"[{root2}]=[https://raw.githubusercontent.com/Source/Package/*]," +
$@"[{root1}]=[https://raw.githubusercontent.com/R1/*]," +
$@"[{root1}sub1{Path.DirectorySeparatorChar}]=[https://raw.githubusercontent.com/M1/*]," +
......@@ -159,6 +167,7 @@ public void TestSourceLink()
},
expectedResults: new[]
{
$@"{root3}: {root3}",
$@"{root2}: {root2}",
$@"{root1}: {root1}",
$@"{root1}sub1{Path.DirectorySeparatorChar}: {root1}sub1{Path.DirectorySeparatorChar}",
......@@ -168,6 +177,7 @@ public void TestSourceLink()
});
AssertEx.AssertEqualToleratingWhitespaceDifferences(
$@"[{root3}]=[]," +
$@"[{root2}]=[https://raw.githubusercontent.com/Source/Package/*]," +
$@"[{root1}]=[https://raw.githubusercontent.com/R1/*]," +
$@"[{root1}sub1{Path.DirectorySeparatorChar}]=[https://raw.githubusercontent.com/M1/*]," +
......@@ -195,6 +205,7 @@ public void TestSourceLink()
},
expectedResults: new[]
{
$@"{root3}: {root3}",
$@"{root2}: {root2}",
$@"{root1}: {root1}",
$@"{root1}sub1{Path.DirectorySeparatorChar}: {root1}sub1{Path.DirectorySeparatorChar}",
......@@ -204,6 +215,7 @@ public void TestSourceLink()
});
AssertEx.AssertEqualToleratingWhitespaceDifferences(
$@"[{root3}]=[]," +
$@"[{root2}]=[https://raw.githubusercontent.com/Source/Package/*]," +
$@"[{root1}]=[https://raw.githubusercontent.com/R1/*]," +
$@"[{root1}sub1{Path.DirectorySeparatorChar}]=[https://raw.githubusercontent.com/M1/*]," +
......@@ -237,15 +249,17 @@ public void TestSourceLink()
},
expectedResults: new[]
{
$@"{root1}: /_/",
$@"{root2}: /_1/",
$@"{root3}: /_/",
$@"{root1}: /_1/",
$@"{root2}: /_2/",
@"true",
$@"{escapedRoot1}=/_/,{escapedRoot2}=/_1/,"
$@"{escapedRoot3}=/_/,{escapedRoot1}=/_1/,{escapedRoot2}=/_2/,"
});
AssertEx.AssertEqualToleratingWhitespaceDifferences(
$@"[/_/]=[https://raw.githubusercontent.com/R1/*]," +
$@"[/_1/]=[https://raw.githubusercontent.com/Source/Package/*]",
$@"[/_/]=[]," +
$@"[/_1/]=[https://raw.githubusercontent.com/R1/*]," +
$@"[/_2/]=[https://raw.githubusercontent.com/Source/Package/*]",
File.ReadAllText(sourceLinkJsonPath));
// No SourceLink package:
......@@ -275,15 +289,17 @@ public void TestSourceLink()
},
expectedResults: new[]
{
$@"{root1}: /_/",
$@"{root2}: /_1/",
$@"{root3}: /_/",
$@"{root1}: /_1/",
$@"{root2}: /_2/",
@"true",
$@"{escapedRoot1}=/_/,{escapedRoot2}=/_1/,"
$@"{escapedRoot3}=/_/,{escapedRoot1}=/_1/,{escapedRoot2}=/_2/,"
});
AssertEx.AssertEqualToleratingWhitespaceDifferences(
$@"[/_/]=[https://raw.githubusercontent.com/R1/*]," +
$@"[/_1/]=[https://raw.githubusercontent.com/Source/Package/*]",
$@"[/_/]=[]," +
$@"[/_1/]=[https://raw.githubusercontent.com/R1/*]," +
$@"[/_2/]=[https://raw.githubusercontent.com/Source/Package/*]",
File.ReadAllText(sourceLinkJsonPath));
}
......
......@@ -6,6 +6,7 @@ Imports System.Collections.Immutable
Imports System.Reflection
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Test.Resources.Proprietary
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
......@@ -13504,7 +13505,7 @@ End Module
</file>
</compilation>
Dim testReference = AssemblyMetadata.CreateFromImage(TestResources.Repros.BadDefaultParameterValue).GetReference()
Dim testReference = AssemblyMetadata.CreateFromImage(ProprietaryTestResources.Repros.BadDefaultParameterValue).GetReference()
Dim compilation = CompileAndVerify(source, references:=New MetadataReference() {testReference})
compilation.VerifyIL("C.Main",
<![CDATA[
......
......@@ -455,7 +455,7 @@ End Class
''' I'm assuming this is why the final dev11 impl uses GetOrCreateEventRegistrationTokenTable.
''' </remarks>
<WorkItem(1003209, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1003209")>
<ConditionalFact(GetType(WindowsOnly), Reason:=ConditionalSkipReason.TestExecutionNeedsWindowsTypes)>
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.WinRTNeedsWindowsDesktop)>
Public Sub FieldLikeEventSerialization()
Dim source1 =
......
......@@ -51,7 +51,7 @@ End Class]]></file>
comp.AssertNoDiagnostics()
End Sub
<Fact()>
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.WinRTNeedsWindowsDesktop)>
Public Sub IVectorProjectionTests()
Dim source =
<compilation>
......@@ -178,7 +178,7 @@ b
]]>.Value)
End Sub
<Fact()>
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.WinRTNeedsWindowsDesktop)>
Public Sub IVectorViewProjectionTests()
Dim source =
......@@ -225,7 +225,7 @@ End Class]]></file>
}]]>.Value)
End Sub
<Fact>
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.WinRTNeedsWindowsDesktop)>
Public Sub IVectorLinqQueryTest()
Dim source =
<compilation>
......@@ -287,7 +287,7 @@ End Class
]]>.Value)
End Sub
<Fact()>
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.WinRTNeedsWindowsDesktop)>
Public Sub IMapProjectionTests()
Dim source =
<compilation>
......
......@@ -27,6 +27,9 @@ public CSharpUseAutoPropertyCodeFixProvider()
{
}
protected override PropertyDeclarationSyntax GetPropertyDeclaration(SyntaxNode node)
=> (PropertyDeclarationSyntax)node;
protected override SyntaxNode GetNodeToRemove(VariableDeclaratorSyntax declarator)
{
var fieldDeclaration = (FieldDeclarationSyntax)declarator.Parent.Parent;
......
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
......@@ -36,6 +38,7 @@ public sealed override ImmutableArray<string> FixableDiagnosticIds
public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer;
protected abstract TPropertyDeclaration GetPropertyDeclaration(SyntaxNode node);
protected abstract SyntaxNode GetNodeToRemove(TVariableDeclarator declarator);
protected abstract IEnumerable<AbstractFormattingRule> GetFormattingRules(Document document);
......@@ -69,21 +72,21 @@ private async Task<Solution> ProcessResultAsync(CodeFixContext context, Diagnost
var propertyLocation = locations[0];
var declaratorLocation = locations[1];
var declarator = declaratorLocation.FindToken(cancellationToken).Parent.FirstAncestorOrSelf<TVariableDeclarator>();
var fieldDocument = context.Document.Project.GetDocument(declarator.SyntaxTree);
var fieldSemanticModel = await fieldDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var solution = context.Document.Project.Solution;
var declarator = (TVariableDeclarator)declaratorLocation.FindNode(cancellationToken);
var fieldDocument = solution.GetRequiredDocument(declarator.SyntaxTree);
var fieldSemanticModel = await fieldDocument.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var fieldSymbol = (IFieldSymbol)fieldSemanticModel.GetDeclaredSymbol(declarator, cancellationToken);
var property = propertyLocation.FindToken(cancellationToken).Parent.FirstAncestorOrSelf<TPropertyDeclaration>();
var propertyDocument = context.Document.Project.GetDocument(property.SyntaxTree);
var propertySemanticModel = await propertyDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var property = GetPropertyDeclaration(propertyLocation.FindNode(cancellationToken));
var propertyDocument = solution.GetRequiredDocument(property.SyntaxTree);
var propertySemanticModel = await propertyDocument.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
var propertySymbol = (IPropertySymbol)propertySemanticModel.GetDeclaredSymbol(property, cancellationToken);
Debug.Assert(fieldDocument.Project == propertyDocument.Project);
var project = fieldDocument.Project;
var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var compilation = await project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
var solution = context.Document.Project.Solution;
var fieldLocations = await Renamer.FindRenameLocationsAsync(
solution, fieldSymbol, RenameOptionSet.From(solution), cancellationToken).ConfigureAwait(false);
......@@ -127,7 +130,8 @@ private async Task<Solution> ProcessResultAsync(CodeFixContext context, Diagnost
// same as the property we're trying to get the references pointing to.
var filteredLocations = fieldLocations.Filter(
location => !location.IntersectsWith(declaratorLocation) &&
location => location.SourceTree != null &&
!location.IntersectsWith(declaratorLocation) &&
CanEditDocument(solution, location.SourceTree, linkedFiles, canEdit));
var resolution = await filteredLocations.ResolveConflictsAsync(
......@@ -140,19 +144,18 @@ private async Task<Solution> ProcessResultAsync(CodeFixContext context, Diagnost
solution = resolution.NewSolution;
// Now find the field and property again post rename.
fieldDocument = solution.GetDocument(fieldDocument.Id);
propertyDocument = solution.GetDocument(propertyDocument.Id);
fieldDocument = solution.GetRequiredDocument(fieldDocument.Id);
propertyDocument = solution.GetRequiredDocument(propertyDocument.Id);
Debug.Assert(fieldDocument.Project == propertyDocument.Project);
compilation = await fieldDocument.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
fieldSymbol = (IFieldSymbol)fieldSymbol.GetSymbolKey(cancellationToken).Resolve(compilation, cancellationToken: cancellationToken).Symbol;
propertySymbol = (IPropertySymbol)propertySymbol.GetSymbolKey(cancellationToken).Resolve(compilation, cancellationToken: cancellationToken).Symbol;
Debug.Assert(fieldSymbol != null && propertySymbol != null);
Contract.ThrowIfTrue(fieldSymbol == null || propertySymbol == null);
declarator = (TVariableDeclarator)await fieldSymbol.DeclaringSyntaxReferences[0].GetSyntaxAsync(cancellationToken).ConfigureAwait(false);
var temp = await propertySymbol.DeclaringSyntaxReferences[0].GetSyntaxAsync(cancellationToken).ConfigureAwait(false);
property = temp.FirstAncestorOrSelf<TPropertyDeclaration>();
property = GetPropertyDeclaration(await propertySymbol.DeclaringSyntaxReferences[0].GetSyntaxAsync(cancellationToken).ConfigureAwait(false));
var nodeToRemove = GetNodeToRemove(declarator);
......@@ -187,7 +190,7 @@ private async Task<Solution> ProcessResultAsync(CodeFixContext context, Diagnost
// because there's nothing to actually separate it from.
if (fieldDocument == propertyDocument)
{
var syntaxFacts = fieldDocument.GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = fieldDocument.GetRequiredLanguageService<ISyntaxFactsService>();
if (WillRemoveFirstFieldInTypeDirectlyAboveProperty(syntaxFacts, property, nodeToRemove) &&
syntaxFacts.GetLeadingBlankLines(nodeToRemove).Length == 0)
{
......@@ -213,10 +216,11 @@ private async Task<Solution> ProcessResultAsync(CodeFixContext context, Diagnost
else
{
// In different files. Just update both files.
var fieldTreeRoot = await fieldDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var propertyTreeRoot = await propertyDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var fieldTreeRoot = await fieldDocument.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var propertyTreeRoot = await propertyDocument.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var newFieldTreeRoot = fieldTreeRoot.RemoveNode(nodeToRemove, syntaxRemoveOptions);
Contract.ThrowIfNull(newFieldTreeRoot);
var newPropertyTreeRoot = propertyTreeRoot.ReplaceNode(property, updatedProperty);
newFieldTreeRoot = await FormatAsync(newFieldTreeRoot, fieldDocument, cancellationToken).ConfigureAwait(false);
......@@ -311,7 +315,7 @@ private async Task<SyntaxNode> FormatAsync(SyntaxNode newRoot, Document document
return false;
}
var syntaxFacts = solution.GetDocument(location.DocumentId).GetLanguageService<ISyntaxFactsService>();
var syntaxFacts = solution.GetRequiredDocument(location.DocumentId).GetRequiredLanguageService<ISyntaxFactsService>();
var node = location.Location.FindToken(cancellationToken).Parent;
while (node != null && !syntaxFacts.IsAnonymousOrLocalFunction(node))
......
......@@ -28,11 +28,11 @@ public Generator(ILsifJsonWriter lsifJsonWriter)
public void GenerateForCompilation(Compilation compilation, string projectPath, HostLanguageServices languageServices)
{
var projectVertex = new Graph.Project(kind: GetLanguageKind(compilation.Language), new Uri(projectPath), _idFactory);
var projectVertex = new Graph.LsifProject(kind: GetLanguageKind(compilation.Language), new Uri(projectPath), _idFactory);
_lsifJsonWriter.Write(projectVertex);
_lsifJsonWriter.Write(new Event(Event.EventKind.Begin, projectVertex.GetId(), _idFactory));
var documentIds = new ConcurrentBag<Id<Graph.Document>>();
var documentIds = new ConcurrentBag<Id<Graph.LsifDocument>>();
// We create a ResultSetTracker to track all top-level symbols in the project. We don't want all writes to immediately go to
// the JSON file -- we support parallel processing, so we'll accumulate them and then apply at once to avoid a lot
......@@ -74,7 +74,7 @@ public void GenerateForCompilation(Compilation compilation, string projectPath,
/// lets us link symbols across files, and will only talk about "top level" symbols that aren't things like locals that can't
/// leak outside a file.
/// </remarks>
private static Id<Graph.Document> GenerateForDocument(
private static Id<Graph.LsifDocument> GenerateForDocument(
SemanticModel semanticModel,
HostLanguageServices languageServices,
IResultSetTracker topLevelSymbolsResultSetTracker,
......@@ -86,7 +86,7 @@ public void GenerateForCompilation(Compilation compilation, string projectPath,
var syntaxFactsService = languageServices.GetRequiredService<ISyntaxFactsService>();
var semanticFactsService = languageServices.GetRequiredService<ISemanticFactsService>();
var documentVertex = new Graph.Document(new Uri(syntaxTree.FilePath), GetLanguageKind(semanticModel.Language), idFactory);
var documentVertex = new Graph.LsifDocument(new Uri(syntaxTree.FilePath), GetLanguageKind(semanticModel.Language), idFactory);
lsifJsonWriter.Write(documentVertex);
lsifJsonWriter.Write(new Event(Event.EventKind.Begin, documentVertex.GetId(), idFactory));
......
......@@ -23,13 +23,13 @@ private Event(EventKind kind, string scope, Id<Element> data, IdFactory idFactor
this.Data = data;
}
public Event(EventKind kind, Id<Project> data, IdFactory idFactory)
: this(kind, "project", data.As<Project, Element>(), idFactory)
public Event(EventKind kind, Id<LsifProject> data, IdFactory idFactory)
: this(kind, "project", data.As<LsifProject, Element>(), idFactory)
{
}
public Event(EventKind kind, Id<Document> data, IdFactory idFactory)
: this(kind, "document", data.As<Document, Element>(), idFactory)
public Event(EventKind kind, Id<LsifDocument> data, IdFactory idFactory)
: this(kind, "document", data.As<LsifDocument, Element>(), idFactory)
{
}
......
......@@ -10,10 +10,10 @@ namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph
/// </summary>
internal sealed class Item : Edge
{
public Id<Document> Document { get; }
public Id<LsifDocument> Document { get; }
public string? Property { get; }
public Item(Id<Vertex> outVertex, Id<Range> range, Id<Document> document, IdFactory idFactory, string? property = null)
public Item(Id<Vertex> outVertex, Id<Range> range, Id<LsifDocument> document, IdFactory idFactory, string? property = null)
: base(label: "item", outVertex, new[] { range.As<Range, Vertex>() }, idFactory)
{
Document = document;
......
......@@ -9,12 +9,12 @@ namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph
/// <summary>
/// Represents the document vertex that contains all the <see cref="Range"/>s. See https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#ranges for examples.
/// </summary>
internal sealed class Document : Vertex
internal sealed class LsifDocument : Vertex
{
public Uri Uri { get; }
public string LanguageId { get; }
public Document(Uri uri, string languageId, IdFactory idFactory)
public LsifDocument(Uri uri, string languageId, IdFactory idFactory)
: base(label: "document", idFactory)
{
this.Uri = uri;
......
......@@ -9,12 +9,12 @@ namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph
/// <summary>
/// Represents a top-level project. See https://github.com/Microsoft/language-server-protocol/blob/master/indexFormat/specification.md#the-project-vertex for further details.
/// </summary>
internal sealed class Project : Vertex
internal sealed class LsifProject : Vertex
{
public string Kind { get; }
public Uri? Resource { get; }
public Project(string kind, Uri? resource, IdFactory idFactory)
public LsifProject(string kind, Uri? resource, IdFactory idFactory)
: base(label: "project", idFactory)
{
Kind = kind;
......
......@@ -19,8 +19,8 @@ Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests
</Project>
</Workspace>))
Dim projectVertex = Assert.Single(lsif.Vertices.OfType(Of Graph.Project))
Dim documentVertices = lsif.GetLinkedVertices(Of Graph.Document)(projectVertex, "contains")
Dim projectVertex = Assert.Single(lsif.Vertices.OfType(Of Graph.LsifProject))
Dim documentVertices = lsif.GetLinkedVertices(Of Graph.LsifDocument)(projectVertex, "contains")
Assert.Single(documentVertices, Function(d) d.Uri.LocalPath = "Z:\A.cs")
Assert.Single(documentVertices, Function(d) d.Uri.LocalPath = "Z:\B.cs")
......
......@@ -162,11 +162,11 @@ Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests
Continue For
End If
Dim documents As New HashSet(Of Graph.Document)
Dim documents As New HashSet(Of Graph.LsifDocument)
' Let's now enumerate all the documents and ranges to see which documents contain a range that links to
' this resultSet
For Each document In lsif.Vertices.OfType(Of Graph.Document)
For Each document In lsif.Vertices.OfType(Of Graph.LsifDocument)
For Each range In lsif.GetLinkedVertices(Of Graph.Range)(document, "contains")
If lsif.GetLinkedVertices(Of Graph.ResultSet)(range, "next").Contains(resultSetVertex) Then
documents.Add(document)
......
......@@ -63,7 +63,7 @@ Namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests.U
For Each testDocument In _workspace.Documents
Dim documentVertex = _testLsifJsonWriter.Vertices _
.OfType(Of Graph.Document) _
.OfType(Of Graph.LsifDocument) _
.Where(Function(d) d.Uri.LocalPath = testDocument.FilePath) _
.Single()
Dim rangeVertices = GetLinkedVertices(Of Range)(documentVertex, "contains")
......
......@@ -21,6 +21,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseAutoProperty
Public Sub New()
End Sub
Protected Overrides Function GetPropertyDeclaration(node As SyntaxNode) As PropertyBlockSyntax
If TypeOf node Is PropertyStatementSyntax Then
node = node.Parent
End If
Return DirectCast(node, PropertyBlockSyntax)
End Function
Protected Overrides Function GetNodeToRemove(identifier As ModifiedIdentifierSyntax) As SyntaxNode
Return Utilities.GetNodeToRemove(identifier)
End Function
......
......@@ -446,7 +446,7 @@ public void DebuggerProxy_FrameworkTypes_IEnumerable()
// the implementation differs between .NET Core and .NET FX
if (str.StartsWith("Enumerable"))
{
Assert.Equal("Enumerable.RangeIterator { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }", str);
Assert.Equal("Enumerable.RangeIterator(Count = 10)", str);
}
else
{
......
......@@ -44,6 +44,8 @@ public static class ConditionalSkipReason
public const string TestHasWindowsPaths = "Test depends on Windows style paths";
public const string TestExecutionNeedsFusion = "Test depends on desktop fusion loader API";
public const string WinRTNeedsWindowsDesktop = "WinRT is only supported on Windows desktop";
/// <summary>
/// Mono issues around Default Interface Methods
/// </summary>
......
......@@ -6,6 +6,7 @@
using System.IO;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Roslyn.Test.Utilities;
public static class TestReferences
......@@ -95,7 +96,7 @@ public static class ValueTuple
public static class silverlight_v5_0_5_0
{
private static readonly Lazy<PortableExecutableReference> s_system = new Lazy<PortableExecutableReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).GetReference(display: "System.v5.0.5.0_silverlight.dll"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).GetReference(display: "System.v5.0.5.0_silverlight.dll"),
LazyThreadSafetyMode.PublicationOnly);
public static PortableExecutableReference System => s_system.Value;
}
......@@ -104,7 +105,7 @@ public static class silverlight_v5_0_5_0
public static class NetStandard13
{
private static readonly Lazy<PortableExecutableReference> s_systemRuntime = new Lazy<PortableExecutableReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime).GetReference(display: @"System.Runtime.dll (netstandard13 ref)"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.netstandard13.System_Runtime).GetReference(display: @"System.Runtime.dll (netstandard13 ref)"),
LazyThreadSafetyMode.PublicationOnly);
public static PortableExecutableReference SystemRuntime => s_systemRuntime.Value;
}
......@@ -694,7 +695,7 @@ public static class MultiTargeting
public static class NoPia
{
private static readonly Lazy<PortableExecutableReference> s_stdOle = new Lazy<PortableExecutableReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.ProprietaryPias.stdole).GetReference(display: "stdole.dll"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.ProprietaryPias.stdole).GetReference(display: "stdole.dll"),
LazyThreadSafetyMode.PublicationOnly);
public static PortableExecutableReference StdOle => s_stdOle.Value;
......
......@@ -15,6 +15,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.Win32;
......@@ -139,7 +140,7 @@ public sealed class DiagnosticDescriptor
var minSystemCollectionsImmutableImage = CSharpCompilation.Create(
"System.Collections.Immutable",
new[] { SyntaxFactory.ParseSyntaxTree(minSystemCollectionsImmutableSource) },
new[] { MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime) },
new[] { MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Runtime) },
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, cryptoPublicKey: TestResources.TestKeys.PublicKey_b03f5f7f11d50a3a)).EmitToArray();
var minSystemCollectionsImmutableRef = MetadataReference.CreateFromImage(minSystemCollectionsImmutableImage);
......@@ -149,7 +150,7 @@ public sealed class DiagnosticDescriptor
new[] { SyntaxFactory.ParseSyntaxTree(minCodeAnalysisSource) },
new[]
{
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Runtime),
minSystemCollectionsImmutableRef
},
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, cryptoPublicKey: TestResources.TestKeys.PublicKey_31bf3856ad364e35)).EmitToArray();
......@@ -241,41 +242,41 @@ public override void Initialize(AnalysisContext context)
{
minCodeAnalysisRef,
minSystemCollectionsImmutableRef,
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.Microsoft_Win32_Primitives),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_AppContext),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Console),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_ValueTuple),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Diagnostics_FileVersionInfo),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Diagnostics_Process),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Diagnostics_StackTrace),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Globalization_Calendars),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_Compression),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_Compression_ZipFile),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_FileSystem),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_FileSystem_Primitives),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_IO_Pipes),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Net_Http),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Net_Security),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Net_Sockets),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Reflection_TypeExtensions),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime_InteropServices_RuntimeInformation),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Runtime_Serialization_Primitives),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_AccessControl),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Claims),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Algorithms),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Csp),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Encoding),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_Primitives),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Cryptography_X509Certificates),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Security_Principal_Windows),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Threading_Thread),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Threading_Tasks_Extensions),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_ReaderWriter),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_XmlDocument),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_XPath),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Xml_XPath_XDocument),
MetadataReference.CreateFromImage(TestResources.NetFX.netstandard13.System_Text_Encoding_CodePages)
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.Microsoft_Win32_Primitives),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_AppContext),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Console),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_ValueTuple),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Diagnostics_FileVersionInfo),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Diagnostics_Process),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Diagnostics_StackTrace),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Globalization_Calendars),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_IO_Compression),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_IO_Compression_ZipFile),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_IO_FileSystem),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_IO_FileSystem_Primitives),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_IO_Pipes),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Net_Http),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Net_Security),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Net_Sockets),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Reflection_TypeExtensions),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Runtime),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Runtime_InteropServices_RuntimeInformation),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Runtime_Serialization_Primitives),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_AccessControl),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_Claims),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_Cryptography_Algorithms),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_Cryptography_Csp),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_Cryptography_Encoding),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_Cryptography_Primitives),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_Cryptography_X509Certificates),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Security_Principal_Windows),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Threading_Thread),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Threading_Tasks_Extensions),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Xml_ReaderWriter),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Xml_XmlDocument),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Xml_XPath),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Xml_XPath_XDocument),
MetadataReference.CreateFromImage(ProprietaryTestResources.netstandard13.System_Text_Encoding_CodePages)
},
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)).EmitToArray();
......
......@@ -15,6 +15,7 @@
using Microsoft.CodeAnalysis.VisualBasic;
using static TestReferences.NetFx;
using static Roslyn.Test.Utilities.TestMetadata;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
namespace Roslyn.Test.Utilities
{
......@@ -94,7 +95,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
var winmd = AssemblyMetadata.CreateFromImage(TestResources.WinRt.Windows).GetReference(display: "Windows");
var windowsruntime =
AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30319_17929.System_Runtime_WindowsRuntime).GetReference(display: "System.Runtime.WindowsRuntime.dll");
AssemblyMetadata.CreateFromImage(ProprietaryTestResources.v4_0_30319_17929.System_Runtime_WindowsRuntime).GetReference(display: "System.Runtime.WindowsRuntime.dll");
var runtime =
AssemblyMetadata.CreateFromImage(ResourcesNet451.SystemRuntime).GetReference(display: "System.Runtime.dll");
......@@ -102,7 +103,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
var objectModel =
AssemblyMetadata.CreateFromImage(ResourcesNet451.SystemObjectModel).GetReference(display: "System.ObjectModel.dll");
var uixaml = AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30319_17929.System_Runtime_WindowsRuntime_UI_Xaml).
var uixaml = AssemblyMetadata.CreateFromImage(ProprietaryTestResources.v4_0_30319_17929.System_Runtime_WindowsRuntime_UI_Xaml).
GetReference(display: "System.Runtime.WindowsRuntime.UI.Xaml.dll");
var interop = AssemblyMetadata.CreateFromImage(ResourcesNet451.SystemRuntimeInteropServicesWindowsRuntime).
......@@ -173,7 +174,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
public static MetadataReference MscorlibRef => s_mscorlibRef.Value;
private static readonly Lazy<MetadataReference> s_mscorlibRefPortable = new Lazy<MetadataReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30319.mscorlib_portable).GetReference(display: "mscorlib.v4_0_30319.portable.dll"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.v4_0_30319.mscorlib_portable).GetReference(display: "mscorlib.v4_0_30319.portable.dll"),
LazyThreadSafetyMode.PublicationOnly);
public static MetadataReference MscorlibRefPortable => s_mscorlibRefPortable.Value;
......@@ -213,7 +214,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
/// Reference to an mscorlib silverlight assembly in which the System.Array does not contain the special member LongLength.
/// </summary>
private static readonly Lazy<MetadataReference> s_mscorlibRef_silverlight = new Lazy<MetadataReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.silverlight_v5_0_5_0.mscorlib_v5_0_5_0_silverlight).GetReference(display: "mscorlib.v5.0.5.0_silverlight.dll"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.silverlight_v5_0_5_0.mscorlib_v5_0_5_0_silverlight).GetReference(display: "mscorlib.v5.0.5.0_silverlight.dll"),
LazyThreadSafetyMode.PublicationOnly);
public static MetadataReference MscorlibRefSilverlight => s_mscorlibRef_silverlight.Value;
......@@ -247,7 +248,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
public static MetadataReference Net46StandardFacade => s_46NetStandardFacade.Value;
private static readonly Lazy<MetadataReference> s_systemDynamicRuntimeRef = new Lazy<MetadataReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard13.System_Dynamic_Runtime).GetReference(display: "System.Dynamic.Runtime.dll (netstandard 1.3 ref)"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.netstandard13.System_Dynamic_Runtime).GetReference(display: "System.Dynamic.Runtime.dll (netstandard 1.3 ref)"),
LazyThreadSafetyMode.PublicationOnly);
public static MetadataReference SystemDynamicRuntimeRef => s_systemDynamicRuntimeRef.Value;
......@@ -302,12 +303,12 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
public static MetadataReference SystemThreadingTaskFacadeRef => s_systemThreadingTasksFacadeRef.Value;
private static readonly Lazy<MetadataReference> s_mscorlibPP7Ref = new Lazy<MetadataReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.ReferenceAssemblies_PortableProfile7.mscorlib).GetReference(display: "mscorlib.dll"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.ReferenceAssemblies_PortableProfile7.mscorlib).GetReference(display: "mscorlib.dll"),
LazyThreadSafetyMode.PublicationOnly);
public static MetadataReference MscorlibPP7Ref => s_mscorlibPP7Ref.Value;
private static readonly Lazy<MetadataReference> s_systemRuntimePP7Ref = new Lazy<MetadataReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.ReferenceAssemblies_PortableProfile7.System_Runtime).GetReference(display: "System.Runtime.dll"),
() => AssemblyMetadata.CreateFromImage(ProprietaryTestResources.ReferenceAssemblies_PortableProfile7.System_Runtime).GetReference(display: "System.Runtime.dll"),
LazyThreadSafetyMode.PublicationOnly);
public static MetadataReference SystemRuntimePP7Ref => s_systemRuntimePP7Ref.Value;
......
......@@ -111,19 +111,6 @@ public async Task OnLoadedAsync()
// initialize things on UI thread
await InitializeOnUIAsync().ConfigureAwait(false);
// wait until remote host is available before let platform know that they can activate our LSP
var client = await RemoteHostClient.TryGetClientAsync(_services, CancellationToken.None).ConfigureAwait(false);
if (client == null)
{
// There is no OOP. either user turned it off, or process got killed.
// We should have already gotten a gold bar + nfw already if the OOP is missing.
// so just log telemetry here so we can connect the two with session explorer.
Logger.Log(FunctionId.LanguageServer_OnLoadedFailed, KeyValueLogMessage.NoProperty);
// don't ask platform to start LSP.
// we shouldn't throw as the LSP client does not expect exceptions here.
return;
}
// let platform know that they can start us
await StartAsync.InvokeAsync(this, EventArgs.Empty).ConfigureAwait(false);
......
......@@ -18,7 +18,7 @@ public CSharpInteractiveCommands(VisualStudioInstanceFactory instanceFactory)
{
}
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/18779")]
[WpfFact]
public void VerifyPreviousAndNextHistory()
{
VisualStudio.InteractiveWindow.SubmitText("1 + 2");
......
......@@ -79,7 +79,7 @@ End Sub
VisualStudio.Editor.Verify.CaretPosition(16);
}
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/34637"), Trait(Traits.Feature, Traits.Features.LineCommit)]
[WpfFact, Trait(Traits.Feature, Traits.Features.LineCommit)]
private void CommitOnSave()
{
VisualStudio.Editor.SetText(@"Module Module1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册