提交 0c500188 编写于 作者: J Julien Couvreur

Merge remote-tracking branch 'dotnet/master' into...

Merge remote-tracking branch 'dotnet/master' into pr/33648-revise-nullablewalker-to-use-a-two-state-solution
......@@ -63,6 +63,17 @@ dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
# Non-private readonly fields are PascalCase
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
# Constants are PascalCase
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
......
......@@ -280,6 +280,7 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.IntegrationTest.Setup", "src\VisualStudio\IntegrationTest\TestSetup\Microsoft.VisualStudio.IntegrationTest.Setup.csproj", "{A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}"
ProjectSection(ProjectDependencies) = postProject
{600AF682-E097-407B-AD85-EE3CED37E680} = {600AF682-E097-407B-AD85-EE3CED37E680}
{A486D7DE-F614-409D-BB41-0FFDF582E35C} = {A486D7DE-F614-409D-BB41-0FFDF582E35C}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.IntegrationTests", "src\VisualStudio\IntegrationTest\IntegrationTests\Microsoft.VisualStudio.LanguageServices.IntegrationTests.csproj", "{E5A55C16-A5B9-4874-9043-A5266DC02F58}"
......
......@@ -11,24 +11,19 @@ Using the command line Roslyn can be developed using the following pattern:
## Recommended version of .NET Framework
The minimal required version of .NET Framework is 4.6, however 4.7.2 is recommended for best developer experience.
The minimal required version of .NET Framework is 4.7.2.
The projects in this repository are configured to build with Portable PDBs, which are supported in stack traces starting with .NET Framework 4.7.2.
If a stack trace is displayed on .NET Framework older than 4.7.2 (e.g. by xUnit when a test fails) it won't contain source and line information.
## Developing with Visual Studio 2019
.NET Framework 4.7.2 is included in [Windows 10 April 2018 Update](https://blogs.windows.com/windowsexperience/2018/04/30/how-to-get-the-windows-10-april-2018-update/). It can also be installed from the [Microsoft Download Center](https://www.microsoft.com/net/download/dotnet-framework-runtime).
## Developing with Visual Studio 2017
1. [Visual Studio 2017 Version 15.7](https://www.visualstudio.com/vs/preview/)
1. [Visual Studio 2019 Preview 4](https://www.visualstudio.com/vs/preview/)
- Ensure C#, VB, MSBuild, .NET Core and Visual Studio Extensibility are included in the selected work loads
- Ensure Visual Studio is on Version "15.7" or greater
- Ensure Visual Studio is on Version "Preview 4" or greater
1. [.NET Core SDK 2.1.401](https://www.microsoft.com/net/download/core) (the installers are: [Windows x64 installer](https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.401/dotnet-sdk-2.1.401-win-x64.exe), [Windows x86 installer](https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.401/dotnet-sdk-2.1.401-win-x86.exe))
1. [PowerShell 3.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 Windows 7. The download link is under the "upgrading existing Windows PowerShell" heading.
1. Run Restore.cmd
1. Open Roslyn.sln
If you already installed Visual Studio and need to add the necessary work loads or move to version 15.7:
If you already installed Visual Studio and need to add the necessary work loads or move to Preview 4:
do the following:
- Run the Visual Studio Installer from your start menu. You can just search for "Visual Studio Installer". If you can't find it, it's typically located at "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe"
......@@ -44,7 +39,7 @@ There are a number of options for running the core Roslyn unit tests:
The Test.cmd script will run our unit test on already built binaries. It can be passed the -build arguments to force a new build before running tests.
1. Run the "Developer Command Prompt for VS2017" from your start menu.
1. Run the "Developer Command Prompt for VS2019" from your start menu.
2. Navigate to the directory of your Git clone.
3. Run `msbuild /v:m /m /nodereuse:false BuildAndTest.proj` in the command prompt.
......
......@@ -2,9 +2,9 @@
<Dependencies>
<ProductDependencies></ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19126.6">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19127.8">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>3f38c38af31863b35c9334320b95cca56e29c942</Sha>
<Sha>f393a6b6b2df0854e051f314977137d31855b6c8</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
......@@ -68,10 +68,9 @@
<MicrosoftMetadataVisualizerVersion>1.0.0-beta1-63011-01</MicrosoftMetadataVisualizerVersion>
<MicrosoftMSXMLVersion>8.0.0.0-alpha</MicrosoftMSXMLVersion>
<MicrosoftNetFrameworkReferenceAssembliesVersion>1.0.0-alpha-004</MicrosoftNetFrameworkReferenceAssembliesVersion>
<MicrosoftNetCompilersVersion>3.0.0-beta2-19068-12</MicrosoftNetCompilersVersion>
<MicrosoftNetCompilersToolsetVersion>3.1.0-beta1-19127-06</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCoreAnalyzersVersion>$(RoslynDiagnosticsNugetPackageVersion)</MicrosoftNetCoreAnalyzersVersion>
<MicrosoftNetCoreILAsmVersion>2.0.0</MicrosoftNetCoreILAsmVersion>
<MicrosoftNETCoreCompilersVersion>3.0.0-beta2-19068-12</MicrosoftNETCoreCompilersVersion>
<MicrosoftNETCorePlatformsVersion>2.1.0</MicrosoftNETCorePlatformsVersion>
<MicrosoftNETCoreRuntimeCoreCLRVersion>2.0.0</MicrosoftNETCoreRuntimeCoreCLRVersion>
<!-- Using a private build of Microsoft.Net.Test.SDK to work around issue https://github.com/Microsoft/vstest/issues/1764 -->
......@@ -279,10 +278,10 @@
<UsingToolXliff>true</UsingToolXliff>
<UsingToolXUnit>true</UsingToolXUnit>
<!--
Use compilers in Microsoft.NET.Compilers package unless we are building with bootstrapped compilers.
Allows to dogfood the latest compiler features.
During the transition period from Microsoft.Net.Compilers to Microsoft.Net.Compilers.Toolset
we are always doing custom importing here.
-->
<UsingToolMicrosoftNetCompilers Condition="'$(BootstrapBuildPath)' == ''">true</UsingToolMicrosoftNetCompilers>
<UsingToolMicrosoftNetCompilers>false</UsingToolMicrosoftNetCompilers>
</PropertyGroup>
<PropertyGroup>
<RestoreSources>
......
......@@ -130,6 +130,14 @@
-->
<Import Project="Bootstrap.props" Condition="'$(BootstrapBuildPath)' != ''" />
<!--
During the transition period from Microsoft.Net.Compilers to Microsoft.Net.Compilers.Toolset
we need our own PackageReference
-->
<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="$(MicrosoftNetCompilersToolsetVersion)" Condition="'$(BootstrapBuildPath)' == ''" PrivateAssets="all" IsImplicitlyDefined="true" />
</ItemGroup>
<!--
Analyzers
-->
......@@ -188,7 +196,7 @@
<!-- C# specific settings -->
<When Condition="'$(Language)' == 'C#'">
<PropertyGroup>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
<WarningLevel>4</WarningLevel>
<ErrorReport>prompt</ErrorReport>
......
......@@ -7,6 +7,6 @@
"xcopy-msbuild": "15.9.0-alpha"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19126.6"
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19127.8"
}
}
......@@ -1337,17 +1337,19 @@ public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpre
int slot = -1;
TypeSymbol type = node.Type;
NullableFlowState resultState = NullableFlowState.NotNull;
if ((object)type != null)
{
bool isTrackableStructType = EmptyStructTypeCache.IsTrackableStructType(type);
var constructor = (node as BoundObjectCreationExpression)?.Constructor;
bool isDefaultValueTypeConstructor = constructor?.IsDefaultValueTypeConstructor() == true;
if (!type.IsValueType || isTrackableStructType)
{
slot = GetOrCreateObjectCreationPlaceholderSlot(node);
if (slot > 0 && isTrackableStructType)
{
this.State[slot] = NullableFlowState.NotNull;
var constructor = (node as BoundObjectCreationExpression)?.Constructor;
bool isDefaultValueTypeConstructor = constructor?.IsDefaultValueTypeConstructor() == true;
var tupleType = constructor?.ContainingType as TupleTypeSymbol;
if ((object)tupleType != null && !isDefaultValueTypeConstructor)
{
......@@ -1364,6 +1366,11 @@ public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpre
}
}
}
else if (type.IsNullableType() && isDefaultValueTypeConstructor)
{
// a nullable value type created with its default constructor is by definition null
resultState = NullableFlowState.MaybeNull;
}
}
if (initializerOpt != null)
......@@ -1371,7 +1378,7 @@ public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpre
VisitObjectCreationInitializer(null, slot, initializerOpt);
}
ResultType = new TypeWithState(type, NullableFlowState.NotNull);
ResultType = new TypeWithState(type, resultState);
}
private void VisitObjectCreationInitializer(Symbol containingSymbol, int containingSlot, BoundExpression node)
......
......@@ -74229,8 +74229,14 @@ public void NullableT_10()
}
}";
var comp = CreateCompilation(source, options: WithNonNullTypesTrue());
// https://github.com/dotnet/roslyn/issues/31502: Recognize Nullable<T> constructors.
comp.VerifyDiagnostics();
comp.VerifyDiagnostics(
// (6,13): warning CS8629: Nullable value type may be null.
// _ = x.Value; // 1
Diagnostic(ErrorCode.WRN_NullableValueTypeMayBeNull, "x").WithLocation(6, 13),
// (10,13): warning CS8629: Nullable value type may be null.
// _ = z.Value; // 2
Diagnostic(ErrorCode.WRN_NullableValueTypeMayBeNull, "z").WithLocation(10, 13)
);
}
[Fact]
......@@ -311,7 +311,7 @@ void followBranch(BasicBlockBuilder current, in BasicBlockBuilder.Branch branch)
}
// Returns whether we should proceed to the destination after finallies were taken care of.
bool stepThroughFinally(ControlFlowRegion region, BasicBlockBuilder destination)
static bool stepThroughFinally(ControlFlowRegion region, BasicBlockBuilder destination)
{
int destinationOrdinal = destination.Ordinal;
while (!region.ContainsBlock(destinationOrdinal))
......
......@@ -92,6 +92,19 @@ public VisualStudioInstance(Process hostProcess, DTE dte, ImmutableHashSet<strin
SupportedPackageIds = supportedPackageIds;
InstallationPath = installationPath;
if (System.Diagnostics.Debugger.IsAttached)
{
// If a Visual Studio debugger is attached to the test process, attach it to the instance running
// integration tests as well.
var debuggerHostDte = GetDebuggerHostDte();
int targetProcessId = Process.GetCurrentProcess().Id;
var localProcess = debuggerHostDte?.Debugger.LocalProcesses.OfType<EnvDTE80.Process2>().FirstOrDefault(p => p.ProcessID == hostProcess.Id);
if (localProcess != null)
{
localProcess.Attach2("Managed");
}
}
StartRemoteIntegrationService(dte);
_integrationServiceChannel = new IpcClientChannel(GetIpcClientChannelName(HostProcess), sinkProvider: null);
......@@ -239,6 +252,21 @@ public void Close(bool exitHostProcess = true)
}
}
private static DTE GetDebuggerHostDte()
{
var currentProcessId = Process.GetCurrentProcess().Id;
foreach (var process in Process.GetProcessesByName("devenv"))
{
var dte = IntegrationHelper.TryLocateDteForProcess(process);
if (dte?.Debugger?.DebuggedProcesses?.OfType<EnvDTE.Process>().Any(p => p.ProcessID == currentProcessId) ?? false)
{
return dte;
}
}
return null;
}
private void CloseHostProcess()
{
_inProc.Quit();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册