diff --git a/Makefile b/Makefile index ee54c779b63b9..504b169d548b9 100644 --- a/Makefile +++ b/Makefile @@ -2,20 +2,24 @@ SHELL = /usr/bin/env bash OS_NAME = $(shell uname -s) BUILD_CONFIGURATION = Debug BINARIES_PATH = $(shell pwd)/Binaries +SCRIPTS_PATH = $(shell pwd)/build/scripts TOOLSET_PATH = $(BINARIES_PATH)/toolset RESTORE_SEMAPHORE_PATH = $(TOOLSET_PATH)/restore.semaphore BOOTSTRAP_PATH = $(BINARIES_PATH)/Bootstrap BUILD_LOG_PATH = HOME_DIR = $(shell cd ~ && pwd) +DOTNET_VERSION = 1.0.0-preview2-002911 MSBUILD_ADDITIONALARGS := /v:m /fl /fileloggerparameters:Verbosity=normal /p:Configuration=$(BUILD_CONFIGURATION) ifeq ($(OS_NAME),Linux) MSBUILD_ADDITIONALARGS := $(MSBUILD_ADDITIONALARGS) /p:BaseNuGetRuntimeIdentifier=ubuntu.14.04 - ROSLYN_TOOLSET_NAME = roslyn.linux.7 + ROSLYN_TOOLSET_NAME = roslyn.linux.8 + DOTNET_PLATFORM = ubuntu-x64 else ifeq ($(OS_NAME),Darwin) MSBUILD_ADDITIONALARGS := $(MSBUILD_ADDITIONALARGS) /p:BaseNuGetRuntimeIdentifier=osx.10.10 - ROSLYN_TOOLSET_NAME = roslyn.mac.6 + ROSLYN_TOOLSET_NAME = roslyn.mac.8 + DOTNET_PLATFORM = osx-x64 endif ifneq ($(BUILD_LOG_PATH),) @@ -69,9 +73,15 @@ toolset: $(ROSLYN_TOOLSET_PATH) $(ROSLYN_TOOLSET_PATH): | $(TOOLSET_PATH) @pushd $(TOOLSET_PATH) ; \ - curl -O https://dotnetci.blob.core.windows.net/roslyn/$(ROSLYN_TOOLSET_NAME).tar.bz2 && \ - tar -jxf $(ROSLYN_TOOLSET_NAME).tar.bz2 && \ - chmod +x $(ROSLYN_TOOLSET_NAME)/corerun + curl -O https://dotnetci.blob.core.windows.net/roslyn/$(ROSLYN_TOOLSET_NAME).zip && \ + curl -O https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/$(DOTNET_VERSION)/dotnet-dev-$(DOTNET_PLATFORM).$(DOTNET_VERSION).tar.gz && \ + mkdir -p $(ROSLYN_TOOLSET_NAME)/dotnet-cli && \ + $(SCRIPTS_PATH)/unzip.sh $(ROSLYN_TOOLSET_NAME).zip $(ROSLYN_TOOLSET_NAME) && \ + tar -zxf dotnet-dev-$(DOTNET_PLATFORM).$(DOTNET_VERSION).tar.gz -C $(ROSLYN_TOOLSET_NAME)/dotnet-cli && \ + chmod +x $(ROSLYN_TOOLSET_NAME)/corerun && \ + chmod +x $(ROSLYN_TOOLSET_NAME)/RoslynRestore && \ + chmod +x $(ROSLYN_TOOLSET_NAME)/csc && \ + chmod +x $(ROSLYN_TOOLSET_NAME)/vbc $(TOOLSET_PATH): mkdir -p $(TOOLSET_PATH) diff --git a/README.md b/README.md index 3244664003109..45cc643d648a2 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ ### Windows - Unit Tests ||Debug x86|Debug x64|Release x86|Release x64|Determinism| |:--:|:--:|:--:|:--:|:--:|:--:| -|**master (1.3)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_determinism/)| -|**future (2.0 Preview 2)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_debug_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_debug_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_debug_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_debug_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_release_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_release_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/windows_determinism/)| +|**stabilization (1.3)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_debug_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_debug_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_debug_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_debug_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_release_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_release_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/windows_determinism/)| +|**master (2.0 Preview 3)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_debug_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/windows_determinism/)| ### Linux/Mac - Unit Tests ||Linux|Mac OSX| |:--:|:--:|:--:| -|**master (1.3)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/linux_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/linux_debug/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/mac_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/mac_debug/)| -|**future (2.0 Preview 2)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/linux_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/linux_debug/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/mac_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/future/job/mac_debug/)| +|**stabilization (1.3)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/linux_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/linux_debug/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/mac_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/stabilization/job/mac_debug/)| +|**master (2.0 Preview 2)**|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/linux_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/linux_debug/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/mac_debug/badge/icon)](http://dotnet-ci.cloudapp.net/job/dotnet_roslyn/job/master/job/mac_debug/)| [//]: # (End current test results) diff --git a/build/BuildNuGets.csx b/build/BuildNuGets.csx index d7b745e631bf4..79a37536cdb05 100644 --- a/build/BuildNuGets.csx +++ b/build/BuildNuGets.csx @@ -76,7 +76,6 @@ var ThirdPartyNoticesPath = Path.Combine(NuGetAdditionalFilesPath, "ThirdPartyNo var NetCompilersPropsPath = Path.Combine(NuGetAdditionalFilesPath, "Microsoft.Net.Compilers.props"); string[] RedistPackageNames = { - "Microsoft.CodeAnalysis.BuildTask.Portable", "Microsoft.CodeAnalysis.Common", "Microsoft.CodeAnalysis.Compilers", "Microsoft.CodeAnalysis.CSharp.Features", diff --git a/build/MSBuildToolset/build-toolset.ps1 b/build/MSBuildToolset/build-toolset.ps1 index 8bc7a586782cf..8d05018cce69e 100644 --- a/build/MSBuildToolset/build-toolset.ps1 +++ b/build/MSBuildToolset/build-toolset.ps1 @@ -1,24 +1,36 @@ # Builds the toolset for use in unix msbuild-coreclr param ( - [string]$NuGetTaskDir = "$PSScriptRoot\..\..\..\NuGet.BuildTasks\src\Microsoft.NuGet.Build.Tasks\bin\Debug" + [string]$NuGetTaskDir, + [string]$RoslynDropDir, + [string]$DotNetPath = "dotnet" ) +function ZipFiles($sourceDir, $zipPath) +{ + If (Test-Path $zipPath) + { + Remove-Item $zipPath + } + + Add-Type -Assembly System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, $zipPath, [System.IO.Compression.CompressionLevel]::Optimal, $false) +} + $ErrorActionPreference="Stop" try { pushd $PSScriptRoot - dotnet restore - dotnet build + & $DotNetPath restore - $dnxcoreDir = "$PSScriptRoot\bin\Debug\dnxcore50" + $outputRoot = "$PSScriptRoot\bin\Debug\netcoreapp1.0" foreach ($TargetRuntime in ("ubuntu.14.04-x64","osx.10.10-x64")) { - dotnet publish -r $TargetRuntime + & $DotNetPath publish -r $TargetRuntime - $publishDir = "$dnxcoreDir\$TargetRuntime\publish" + $publishDir = "$outputRoot\$TargetRuntime\publish" # Fix up AssignLinkMetadata # TODO(https://github.com/Microsoft/msbuild/issues/544) @@ -35,46 +47,65 @@ try Copy-Item -Force "$NuGetTaskDir\*" $NuGetExtensionsDir # Copy the portable targets + write-host "Copy portable targets" Copy-Item -Force -Recurse (Join-Path ([Environment]::GetFolderPath("ProgramFilesX86")) "MSBuild\Microsoft\Portable") "$extensionsMSDir" - + # Copy over the portable build task # TODO(https://github.com/dotnet/roslyn/issues/9640) - # Copy from a NuGet package instead of a build - foreach ($item in ("Microsoft.Build.Tasks.CodeAnalysis.dll","Microsoft.CSharp.Core.targets","Microsoft.VisualBasic.Core.targets")) + # Copy from a NuGet package instead of a build. + # Overwrite dlls pulled in by the references listed in project.json + # (we want a specific toolset compiler version). + write-host "Copy portable build task" + foreach ($item in ( + "CodeAnalysisBuildTask\Microsoft.Build.Tasks.CodeAnalysis.dll", + "CodeAnalysisBuildTask\Microsoft.CSharp.Core.targets", + "CodeAnalysisBuildTask\Microsoft.VisualBasic.Core.targets", + "System.Reflection.Metadata.dll", + "System.Collections.Immutable.dll", + "Microsoft.CodeAnalysis.dll", + "Microsoft.CodeAnalysis.CSharp.dll", + "Microsoft.CodeAnalysis.VisualBasic.dll", + "csccore\csc.exe", + "vbccore\vbc.exe")) { - Copy-Item (Join-Path $PSScriptRoot\..\..\Binaries\Debug\CodeAnalysisBuildTask $item) $publishDir + Copy-Item (Join-Path $RoslynDropDir "20160525.2" $item) $publishDir } - # Copy over the reference assemblies $frameworkRefsDir = "$publishDir\reference-assemblies\Framework" mkdir -Force "$frameworkRefsDir\.NETFramework" + + write-host "Copy .NETFramework/v4.5 reference assemblies" Copy-Item -Force -Recurse (Join-Path ([Environment]::GetFolderPath("ProgramFilesX86")) "Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5") "$frameworkRefsDir\.NETFramework" + write-host "Copy .NETPortable reference assemblies" Copy-Item -Force -Recurse (Join-Path ([Environment]::GetFolderPath("ProgramFilesX86")) "Reference Assemblies\Microsoft\Framework\.NETPortable") $frameworkRefsDir # Bug: https://github.com/Microsoft/msbuild/issues/522 # Reference assembly has a bad name, fixup pushd "$publishDir\reference-assemblies\Framework\.NETFramework\v4.5" - Move-Item System.XML.dll System.Xml.dll - popd # TODO(https://github.com/dotnet/roslyn/issues/9641) # Portable CSharp targets have ref with wrong case + write-host "Copy portable targets files" foreach ($version in ("v4.5","v5.0")) { $file = "$extensionsMSDir\Portable\$version\Microsoft.Portable.CSharp.targets" (Get-Content $file) | %{ $_ -replace 'Microsoft.CSharp.Targets','Microsoft.CSharp.targets' } | Out-File $file } - # Copy the helper scripts for csc/vbc + write-host "Copy helper scripts for csc" Copy-Item -Force "$PSScriptRoot\..\..\src\Compilers\CSharp\CscCore\csc" $publishDir + + write-host "Copy helper scripts for vbc" Copy-Item -Force "$PSScriptRoot\..\..\src\Compilers\VisualBasic\VbcCore\vbc" $publishDir - Move-Item $publishDir + $toolsetPackageZip = (Join-Path $outputRoot "$TargetRuntime.zip") + Write-Host "Zipping $publishDir to $toolsetPackageZip" + ZipFiles $publishDir $toolsetPackageZip } popd diff --git a/build/MSBuildToolset/project.json b/build/MSBuildToolset/project.json index 6d3f016cc3451..7a765fbaeaa95 100644 --- a/build/MSBuildToolset/project.json +++ b/build/MSBuildToolset/project.json @@ -6,29 +6,23 @@ }, "dependencies": { - "Microsoft.Build.Framework": "0.1.0-preview-00017", - "Microsoft.Build.Tasks.Core": "0.1.0-preview-00017", - "Microsoft.Build.Utilities.Core": "0.1.0-preview-00017", - "Microsoft.Build.Targets": "0.1.0-preview-00017", - "Microsoft.Build": "0.1.0-preview-00017", - "Microsoft.Net.Compilers.netcore": "1.2.0-beta1-20160202-02", - "Microsoft.Net.Compilers.Targets.netcore": "0.1.4-dev", - "Microsoft.NETCore.Platforms": "1.0.1-rc2-23811", - "Microsoft.NETCore.TestHost": "1.0.0-rc2-23811", - "NETStandard.Library": "1.0.0-rc2-23811", - "MSBuild": "0.1.0-preview-00017", - "System.Security.Cryptography.X509Certificates": "4.0.0-rc2-23811", - "System.Diagnostics.Process": "4.1.0-rc2-23811", + "Microsoft.Build.Framework": "0.1.0-preview-00023-160527", + "Microsoft.Build.Tasks.Core": "0.1.0-preview-00023-160527", + "Microsoft.Build.Utilities.Core": "0.1.0-preview-00023-160527", + "Microsoft.Build.Targets": "0.1.0-preview-00023-160527", + "Microsoft.Build": "0.1.0-preview-00023-160527", + "MSBuild": "0.1.0-preview-00023-160527", + "Microsoft.NETCore.TestHost": "1.0.0-rc3-24128-00", + "Microsoft.NETCore.App": "1.0.0-rc3-004338", "Newtonsoft.Json": "7.0.1" }, "frameworks": { - "dnxcore50": { - "imports": "portable-net452" + "NETCoreApp1.0": { + "imports": ["portable-net452", "dotnet"] } }, "runtimes": { - "win7-x64": { }, "ubuntu.14.04-x64": { }, "osx.10.10-x64": { } } diff --git a/build/Targets/VSL.Imports.targets b/build/Targets/VSL.Imports.targets index f9172be6eba22..411cd77c1b86d 100644 --- a/build/Targets/VSL.Imports.targets +++ b/build/Targets/VSL.Imports.targets @@ -191,7 +191,7 @@ '$(TargetFrameworkVersion)' == 'v5.0'"> - DNXCore,Version=v5.0 + .NETCoreApp,Version=v1.0 win7 diff --git a/build/scripts/crossgen.sh b/build/scripts/crossgen.sh index 4708c35387991..53dbaa4679d2c 100755 --- a/build/scripts/crossgen.sh +++ b/build/scripts/crossgen.sh @@ -24,7 +24,7 @@ if [ -z "$RID" ]; then fi # Replace with a robust method for finding the right crossgen.exe -CROSSGEN_UTIL=~/.nuget/packages/runtime.$RID.Microsoft.NETCore.Runtime.CoreCLR/1.0.2-rc3-24102-00/tools/crossgen +CROSSGEN_UTIL=~/.nuget/packages/runtime.$RID.Microsoft.NETCore.Runtime.CoreCLR/1.0.2-rc3-24128-00/tools/crossgen cd $BIN_DIR diff --git a/build/scripts/unzip.sh b/build/scripts/unzip.sh new file mode 100755 index 0000000000000..39f7a971d99a0 --- /dev/null +++ b/build/scripts/unzip.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Unzip reports a warning that zip contains backslashes and returns exit code 1 +# even though everything is good. Ignore exit code 1. + +unzip -nq $1 -d $2 +EC=$? +if [ $EC -eq 1 ] + then exit 0 + else exit $EC +fi \ No newline at end of file diff --git a/docs/infrastructure/unix-toolset.md b/docs/infrastructure/unix-toolset.md index d94a3a213fa6f..7946c32097366 100644 --- a/docs/infrastructure/unix-toolset.md +++ b/docs/infrastructure/unix-toolset.md @@ -17,8 +17,13 @@ To build the toolset do the following: - If necessary, make modifications to the dependencies in the `build/MSBuildToolset/project.json` file to bring in anything new. - Run the `build/MSBuildToolset/build-toolset.ps1` file. -- In the `build/MSBuildToolset/bin/Debug/dnxcore50` directory: - - Rename and bzip the `osx.10.10-x64/publish` directory as roslyn.mac.`` - - Rename and bzip the `ubuntu.14.04-x65/publish` directory as roslyn.linux.`` -- Upload the file to the Azure in the dotnetci storage account in the roslyn container. +- The script produces two zip files in bin\Debug\netcoreapp1.0 subdirectory: + - Rename `osx.10.10-x64.zip` to roslyn.mac.`.zip` + - Rename `ubuntu.14.04-x64.zip` to roslyn.linux.`.zip` +- Upload the files to the Azure in the dotnetci storage account in the roslyn container: + +``` +azcopy /Pattern:*.zip /Source:build\MSBuildToolset\bin\Debug\netcoreapp1.0 /Dest:https://dotnetci.blob.core.windows.net/roslyn /DestKey:<> +``` + - Send a PR to change [Makefile](https://github.com/dotnet/roslyn/blob/master/Makefile) to use the new toolset. diff --git a/netci.groovy b/netci.groovy index 69a65f9299849..74439c86412ab 100644 --- a/netci.groovy +++ b/netci.groovy @@ -121,7 +121,7 @@ commitPullList.each { isPr -> } def triggerPhraseOnly = false - def triggerPhraseExtra = "" + def triggerPhraseExtra = "linux" Utilities.setMachineAffinity(myJob, 'Ubuntu14.04', 'latest-or-auto') Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml') addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly) @@ -139,7 +139,7 @@ commitPullList.each { isPr -> } def triggerPhraseOnly = true - def triggerPhraseExtra = "" + def triggerPhraseExtra = "mac" Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml') addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly) } diff --git a/nuget.exe b/nuget.exe index 1684f37e1e415..2831a8e23a899 100644 Binary files a/nuget.exe and b/nuget.exe differ diff --git a/src/Compilers/CSharp/CscCore/project.json b/src/Compilers/CSharp/CscCore/project.json index 7a792911bbc63..ba94bd3e4a94d 100644 --- a/src/Compilers/CSharp/CscCore/project.json +++ b/src/Compilers/CSharp/CscCore/project.json @@ -1,7 +1,7 @@ { "dependencies": { }, "frameworks": { - "dnxcore50": { + "NETCoreApp1.0": { "imports": "portable-net452" } }, diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs index f7bdcad4e1664..2b68f8de52259 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs @@ -545,7 +545,17 @@ private bool MemberGroupFinalValidationAccessibilityChecks(BoundExpression recei else if (memberSymbol.IsStatic) { Debug.Assert(!invokedAsExtensionMethod || (receiverOpt != null)); - if (!invokedAsExtensionMethod && !WasImplicitReceiver(receiverOpt) && IsMemberAccessedThroughVariableOrValue(receiverOpt)) + + if (invokedAsExtensionMethod) + { + if (receiverOpt?.Kind == BoundKind.QueryClause && IsMemberAccessedThroughType(receiverOpt)) + { + // Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. + diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, receiverOpt.Type, memberSymbol.Name); + return true; + } + } + else if (!WasImplicitReceiver(receiverOpt) && IsMemberAccessedThroughVariableOrValue(receiverOpt)) { if (this.Flags.Includes(BinderFlags.CollectionInitializerAddMethod)) { diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index d609a6103e0fc..d00c2e4a1b666 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -6325,9 +6325,13 @@ private BoundExpression BindIndexerOrIndexedPropertyAccess( if (analyzedArguments.HasDynamicArgument && overloadResolutionResult.HasAnyApplicableMember) { - var result = BindDynamicIndexer(syntax, receiverOpt, analyzedArguments, overloadResolutionResult.GetAllApplicableMembers(), diagnostics); + // Note that the runtime binder may consider candidates that haven't passed compile-time final validation + // and an ambiguity error may be reported. Also additional checks are performed in runtime final validation + // that are not performed at compile-time. + // Only if the set of final applicable candidates is empty we know for sure the call will fail at runtime. + var finalApplicableCandidates = GetCandidatesPassingFinalValidation(syntax, overloadResolutionResult, receiverOpt, default(ImmutableArray), diagnostics); overloadResolutionResult.Free(); - return result; + return BindDynamicIndexer(syntax, receiverOpt, analyzedArguments, finalApplicableCandidates, diagnostics); } if (!overloadResolutionResult.Succeeded) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs index 763599635e26d..2d853ba168886 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs @@ -546,7 +546,10 @@ private BoundExpression BindMethodGroupInvocation( // and an ambiguity error may be reported. Also additional checks are performed in runtime final validation // that are not performed at compile-time. // Only if the set of final applicable candidates is empty we know for sure the call will fail at runtime. - var finalApplicableCandidates = GetCandidatesPassingFinalValidation(syntax, resolution.OverloadResolutionResult, methodGroup, diagnostics); + var finalApplicableCandidates = GetCandidatesPassingFinalValidation(syntax, resolution.OverloadResolutionResult, + methodGroup.ReceiverOpt, + methodGroup.TypeArgumentsOpt, + diagnostics); if (finalApplicableCandidates.Length > 0) { result = BindDynamicInvocation(syntax, methodGroup, resolution.AnalyzedArguments, finalApplicableCandidates, diagnostics, queryClause); @@ -648,11 +651,16 @@ private BoundExpression BindLocalFunctionInvocationWithDynamicArgument( queryClause: queryClause); } - private ImmutableArray GetCandidatesPassingFinalValidation(CSharpSyntaxNode syntax, OverloadResolutionResult overloadResolutionResult, BoundMethodGroup methodGroup, DiagnosticBag diagnostics) + private ImmutableArray GetCandidatesPassingFinalValidation( + CSharpSyntaxNode syntax, + OverloadResolutionResult overloadResolutionResult, + BoundExpression receiverOpt, + ImmutableArray typeArgumentsOpt, + DiagnosticBag diagnostics) where TMethodOrPropertySymbol : Symbol { Debug.Assert(overloadResolutionResult.HasAnyApplicableMember); - var finalCandidates = ArrayBuilder.GetInstance(); + var finalCandidates = ArrayBuilder.GetInstance(); DiagnosticBag firstFailed = null; DiagnosticBag candidateDiagnostics = DiagnosticBag.GetInstance(); @@ -669,8 +677,8 @@ private ImmutableArray GetCandidatesPassingFinalValidation(CSharpS // * If F is an instance method, the method group must have resulted from a simple-name, a member-access through a variable or value, // or a member-access whose receiver can't be classified as a type or value until after overload resolution (see §7.6.4.1). - if (!MemberGroupFinalValidationAccessibilityChecks(methodGroup.ReceiverOpt, result.Member, syntax, candidateDiagnostics, invokedAsExtensionMethod: false) && - (methodGroup.TypeArgumentsOpt.IsDefault || result.Member.CheckConstraints(this.Conversions, syntax, this.Compilation, candidateDiagnostics))) + if (!MemberGroupFinalValidationAccessibilityChecks(receiverOpt, result.Member, syntax, candidateDiagnostics, invokedAsExtensionMethod: false) && + (typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(this.Conversions, syntax, this.Compilation, candidateDiagnostics))) { finalCandidates.Add(result.Member); continue; diff --git a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs index 7f15438e731dc..2d216987f384c 100644 --- a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs +++ b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs @@ -1867,6 +1867,14 @@ internal DeclarationTable Declarations } } + internal MergedNamespaceDeclaration MergedRootDeclaration + { + get + { + return Declarations.GetMergedRoot(this); + } + } + /// /// Gets the diagnostics produced during the parsing stage of a compilation. There are no diagnostics for declarations or accessor or /// method bodies, for example. @@ -2872,7 +2880,7 @@ internal override int CompareSourceLocations(Location loc1, Location loc2) throw new ArgumentException(CSharpResources.NoNoneSearchCriteria, nameof(filter)); } - return this.Declarations.ContainsName(predicate, filter, cancellationToken); + return DeclarationTable.ContainsName(this.MergedRootDeclaration, predicate, filter, cancellationToken); } /// @@ -2964,7 +2972,7 @@ public IEnumerable GetSymbolsWithName(Func predicate, Sym var result = new HashSet(); var spine = new List(); - AppendSymbolsWithName(spine, _compilation.Declarations.MergedRoot, predicate, filter, result, cancellationToken); + AppendSymbolsWithName(spine, _compilation.MergedRootDeclaration, predicate, filter, result, cancellationToken); return result; } diff --git a/src/Compilers/CSharp/Portable/Declarations/DeclarationTable.cs b/src/Compilers/CSharp/Portable/Declarations/DeclarationTable.cs index 8b731bffa4f44..406d87f1537b5 100644 --- a/src/Compilers/CSharp/Portable/Declarations/DeclarationTable.cs +++ b/src/Compilers/CSharp/Portable/Declarations/DeclarationTable.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -using System.Linq; +using System.Diagnostics; using System.Threading; using Roslyn.Utilities; @@ -32,7 +32,7 @@ internal sealed partial class DeclarationTable private readonly Cache _cache; // The lazily computed total merged declaration. - private readonly Lazy _mergedRoot; + private MergedNamespaceDeclaration _mergedRoot; private readonly Lazy> _typeNames; private readonly Lazy> _namespaceNames; @@ -46,7 +46,6 @@ private DeclarationTable( _allOlderRootDeclarations = allOlderRootDeclarations; _latestLazyRootDeclaration = latestLazyRootDeclaration; _cache = cache ?? new Cache(this); - _mergedRoot = new Lazy(GetMergedRoot); _typeNames = new Lazy>(GetMergedTypeNames); _namespaceNames = new Lazy>(GetMergedNamespaceNames); _referenceDirectives = new Lazy>(GetMergedReferenceDirectives); @@ -88,18 +87,6 @@ public DeclarationTable RemoveRootDeclaration(Lazy AllRootNamespacesUnordered() - { - if (_latestLazyRootDeclaration == null) - { - return _allOlderRootDeclarations; - } - else - { - return _allOlderRootDeclarations.Concat(SpecializedCollections.SingletonEnumerable(_latestLazyRootDeclaration.Value)); - } - } - // The merged-tree-reuse story goes like this. We have a "forest" of old declarations, and // possibly a lone tree of new declarations. We construct a merged declaration by merging // together everything in the forest. This we can re-use from edit to edit, provided that @@ -114,8 +101,18 @@ public IEnumerable AllRootNamespacesUnordered() // old merged root new merged root // / | | | \ \ // old singles forest new single tree + public MergedNamespaceDeclaration GetMergedRoot(CSharpCompilation compilation) + { + Debug.Assert(compilation.Declarations == this); + if (_mergedRoot == null) + { + Interlocked.CompareExchange(ref _mergedRoot, CalculateMergedRoot(compilation), null); + } + return _mergedRoot; + } - private MergedNamespaceDeclaration GetMergedRoot() + // Internal for unit tests only. + internal MergedNamespaceDeclaration CalculateMergedRoot(CSharpCompilation compilation) { var oldRoot = _cache.MergedRoot.Value; if (_latestLazyRootDeclaration == null) @@ -128,7 +125,31 @@ private MergedNamespaceDeclaration GetMergedRoot() } else { - return MergedNamespaceDeclaration.Create(oldRoot, _latestLazyRootDeclaration.Value); + var oldRootDeclarations = oldRoot.Declarations; + var builder = ArrayBuilder.GetInstance(oldRootDeclarations.Length + 1); + builder.AddRange(oldRootDeclarations); + builder.Add(_latestLazyRootDeclaration.Value); + // Sort the root namespace declarations to match the order of SyntaxTrees. + if (compilation != null) + { + builder.Sort(new RootNamespaceLocationComparer(compilation)); + } + return MergedNamespaceDeclaration.Create(builder.ToImmutableAndFree()); + } + } + + private sealed class RootNamespaceLocationComparer : IComparer + { + private readonly CSharpCompilation _compilation; + + internal RootNamespaceLocationComparer(CSharpCompilation compilation) + { + _compilation = compilation; + } + + public int Compare(SingleNamespaceDeclaration x, SingleNamespaceDeclaration y) + { + return _compilation.CompareSourceLocations(x.Location, y.Location); } } @@ -215,14 +236,6 @@ private static ISet GetNames(Declaration declaration, Predicate TypeNames { get @@ -247,14 +260,18 @@ public IEnumerable ReferenceDirectives } } - public bool ContainsName(Func predicate, SymbolFilter filter, CancellationToken cancellationToken) + public static bool ContainsName( + MergedNamespaceDeclaration mergedRoot, + Func predicate, + SymbolFilter filter, + CancellationToken cancellationToken) { var includeNamespace = (filter & SymbolFilter.Namespace) == SymbolFilter.Namespace; var includeType = (filter & SymbolFilter.Type) == SymbolFilter.Type; var includeMember = (filter & SymbolFilter.Member) == SymbolFilter.Member; var stack = new Stack(); - stack.Push(this.MergedRoot); + stack.Push(mergedRoot); while (stack.Count > 0) { diff --git a/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs b/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs index 4dfe30e339e30..dec9e2508d1ca 100644 --- a/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs +++ b/src/Compilers/CSharp/Portable/Declarations/DeclarationTreeBuilder.cs @@ -221,9 +221,9 @@ public override SingleNamespaceOrTypeDeclaration VisitNamespaceDeclaration(Names bool hasExterns = node.Externs.Any(); NameSyntax name = node.Name; CSharpSyntaxNode currentNode = node; - while (name is QualifiedNameSyntax) + QualifiedNameSyntax dotted; + while ((dotted = name as QualifiedNameSyntax) != null) { - var dotted = name as QualifiedNameSyntax; var ns = SingleNamespaceDeclaration.Create( name: dotted.Right.Identifier.ValueText, hasUsings: hasUsings, diff --git a/src/Compilers/CSharp/Portable/Declarations/MergedNamespaceDeclaration.cs b/src/Compilers/CSharp/Portable/Declarations/MergedNamespaceDeclaration.cs index fbef92d86b983..74a1402470d02 100644 --- a/src/Compilers/CSharp/Portable/Declarations/MergedNamespaceDeclaration.cs +++ b/src/Compilers/CSharp/Portable/Declarations/MergedNamespaceDeclaration.cs @@ -29,13 +29,6 @@ public static MergedNamespaceDeclaration Create(SingleNamespaceDeclaration decla return new MergedNamespaceDeclaration(ImmutableArray.Create(declaration)); } - public static MergedNamespaceDeclaration Create( - MergedNamespaceDeclaration mergedDeclaration, - SingleNamespaceDeclaration declaration) - { - return new MergedNamespaceDeclaration(mergedDeclaration._declarations.Add(declaration)); - } - public override DeclarationKind Kind { get diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs index 450c975c92c34..690936656e749 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs @@ -1439,13 +1439,18 @@ internal CommonAssemblyWellKnownAttributeData GetNetModuleDecodedWellKnownAttrib internal ImmutableArray> GetAttributeDeclarations() { - var attrList = - from rootNs in DeclaringCompilation.Declarations.AllRootNamespacesUnordered() - where rootNs.HasAssemblyAttributes - select rootNs.Location.SourceTree into tree - orderby _compilation.GetSyntaxTreeOrdinal(tree) - select ((CompilationUnitSyntax)tree.GetRoot()).AttributeLists; - return attrList.ToImmutableArray(); + var builder = ArrayBuilder>.GetInstance(); + var declarations = DeclaringCompilation.MergedRootDeclaration.Declarations; + foreach (RootSingleNamespaceDeclaration rootNs in declarations) + { + if (rootNs.HasAssemblyAttributes) + { + var tree = rootNs.Location.SourceTree; + var root = (CompilationUnitSyntax)tree.GetRoot(); + builder.Add(root.AttributeLists); + } + } + return builder.ToImmutableAndFree(); } private void EnsureAttributesAreBound() diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceModuleSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceModuleSymbol.cs index b6ead4a5a8e61..1fd86ad09d535 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceModuleSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceModuleSymbol.cs @@ -186,18 +186,14 @@ public override NamespaceSymbol GlobalNamespace { if ((object)_globalNamespace == null) { - Interlocked.CompareExchange(ref _globalNamespace, MakeGlobalNamespace(), null); + var globalNS = new SourceNamespaceSymbol(this, this, DeclaringCompilation.MergedRootDeclaration); + Interlocked.CompareExchange(ref _globalNamespace, globalNS, null); } return _globalNamespace; } } - private SourceNamespaceSymbol MakeGlobalNamespace() - { - return new SourceNamespaceSymbol(this, this, _sources.MergedRoot); - } - internal sealed override bool RequiresCompletion { get { return true; } @@ -347,9 +343,9 @@ public override ImmutableArray Locations { if (_locations.IsDefault) { - ImmutableInterlocked.InterlockedCompareExchange(ref _locations, - _sources.AllRootNamespacesUnordered().Select(n => n.Location).AsImmutable(), - default(ImmutableArray)); + ImmutableInterlocked.InterlockedInitialize( + ref _locations, + DeclaringCompilation.MergedRootDeclaration.Declarations.SelectAsArray(d => (Location)d.Location)); } return _locations; diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/DynamicTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/DynamicTests.cs index 53d3104e5875f..1f6b116f7313c 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/DynamicTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/DynamicTests.cs @@ -3550,5 +3550,260 @@ .maxstack 8 Assert.Equal(typeGConstructed, typeD.GetMember("ExtraTrue").Type); Assert.Equal(typeGConstructed, typeD.GetMember("ExtraFalse").Type); } + + [ClrOnlyFact(ClrOnlyReason.Ilasm)] + [WorkItem(204561, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=204561&_a=edit")] + public void SuppressDynamicIndexerAccessOffOfType_01() + { + var iLSource = @" +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} + +.assembly Microsoft.Office.Interop.Excel +{ + .custom instance void [mscorlib]System.Runtime.InteropServices.ImportedFromTypeLibAttribute::.ctor(string) = ( 01 00 05 45 78 63 65 6C 00 00 ) // ...Excel.. + .custom instance void [mscorlib]System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute::.ctor(int32, + int32) = ( 01 00 01 00 00 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 30 30 30 32 30 38 31 33 2D 30 30 30 30 // ..$00020813-0000 + 2D 30 30 30 30 2D 63 30 30 30 2D 30 30 30 30 30 // -0000-c000-00000 + 30 30 30 30 30 34 36 00 00 ) // 0000046.. + .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibVersionAttribute::.ctor(int32, + int32) = ( 01 00 01 00 00 00 08 00 00 00 00 00 ) + .hash algorithm 0x00008004 + .ver 15:0:0:0 +} +.module Excel.dll +// MVID: {C7C599B3-5C80-48BC-9637-7CADFEF6DEB8} +.imagebase 0x00400000 +.file alignment 0x00001000 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000009 // ILONLY +// Image base: 0x050E0000 + +.class interface public abstract auto ansi import Microsoft.Office.Interop.Excel.Worksheet + implements Microsoft.Office.Interop.Excel._Worksheet +{ + .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 30 30 30 32 30 38 44 38 2D 30 30 30 30 // ..$000208D8-0000 + 2D 30 30 30 30 2D 43 30 30 30 2D 30 30 30 30 30 // -0000-C000-00000 + 30 30 30 30 30 34 36 00 00 ) // 0000046.. +} // end of class Microsoft.Office.Interop.Excel.Worksheet + +.class interface public abstract auto ansi import Microsoft.Office.Interop.Excel._Worksheet +{ + .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(int16) = ( 01 00 C0 10 00 00 ) + .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 30 30 30 32 30 38 44 38 2D 30 30 30 30 // ..$000208D8-0000 + 2D 30 30 30 30 2D 43 30 30 30 2D 30 30 30 30 30 // -0000-C000-00000 + 30 30 30 30 30 34 36 00 00 ) // 0000046.. + + .method public hidebysig newslot specialname abstract virtual + instance class Microsoft.Office.Interop.Excel.Range + marshal( interface ) + get_Range([in] object marshal( struct) Cell1, + [in][opt] object marshal( struct) Cell2) runtime managed internalcall + { + .custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 C5 00 00 00 00 00 ) + } // end of method _Worksheet::get_Range + + .property class Microsoft.Office.Interop.Excel.Range + Range(object, + object) + { + .custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 C5 00 00 00 00 00 ) + .get instance class Microsoft.Office.Interop.Excel.Range Microsoft.Office.Interop.Excel._Worksheet::get_Range(object, + object) + } // end of property _Worksheet::Range + + .method public hidebysig newslot specialname abstract virtual + instance class Microsoft.Office.Interop.Excel.Range + marshal( interface ) + MRange([in] object marshal( struct) Cell1, + [in][opt] object marshal( struct) Cell2) runtime managed internalcall + { + .custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 C5 00 00 00 00 00 ) + } // end of method _Worksheet::get_Range +} + +.class interface public abstract auto ansi import Microsoft.Office.Interop.Excel.Range + implements [mscorlib]System.Collections.IEnumerable +{ + .custom instance void [mscorlib]System.Runtime.InteropServices.InterfaceTypeAttribute::.ctor(int16) = ( 01 00 02 00 00 00 ) + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 08 5F 44 65 66 61 75 6C 74 00 00 ) // ..._Default.. + .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 30 30 30 32 30 38 34 36 2D 30 30 30 30 // ..$00020846-0000 + 2D 30 30 30 30 2D 43 30 30 30 2D 30 30 30 30 30 // -0000-C000-00000 + 30 30 30 30 30 34 36 00 00 ) // 0000046.. + .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(int16) = ( 01 00 00 10 00 00 ) +} +"; + + MetadataReference reference = CompileIL(iLSource, appendDefaultHeader: false, embedInteropTypes: false); + + string consumer1 = @" +using Microsoft.Office.Interop.Excel; + +class Test +{ + public static void Main() + { + dynamic x = 1; + dynamic y = 1; + + var z2 = Worksheet.MRange(x, y); + } +} +"; + + var compilation1 = CreateCompilationWithMscorlib(consumer1, options: TestOptions.ReleaseExe, + references: new MetadataReference[] { reference, CSharpRef, SystemCoreRef }); + + compilation1.VerifyDiagnostics( + // (11,18): error CS0120: An object reference is required for the non-static field, method, or property '_Worksheet.MRange(object, object)' + // var z2 = Worksheet.MRange(x, y); + Diagnostic(ErrorCode.ERR_ObjectRequired, "Worksheet.MRange(x, y)").WithArguments("Microsoft.Office.Interop.Excel._Worksheet.MRange(object, object)").WithLocation(11, 18) + ); + + string consumer2 = @" +using Microsoft.Office.Interop.Excel; + +class Test +{ + public static void Main() + { + dynamic x = 1; + dynamic y = 1; + var z1 = Worksheet.Range[x, y]; + } +} +"; + + var compilation2 = CreateCompilationWithMscorlib(consumer2, options: TestOptions.ReleaseExe, + references: new MetadataReference[] { reference, CSharpRef, SystemCoreRef }); + + compilation2.VerifyDiagnostics( + // (10,18): error CS0120: An object reference is required for the non-static field, method, or property '_Worksheet.Range[object, object]' + // var z1 = Worksheet.Range[x, y]; + Diagnostic(ErrorCode.ERR_ObjectRequired, "Worksheet.Range[x, y]").WithArguments("Microsoft.Office.Interop.Excel._Worksheet.Range[object, object]").WithLocation(10, 18) + ); + } + + [ClrOnlyFact(ClrOnlyReason.Ilasm)] + [WorkItem(204561, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=204561&_a=edit")] + public void SuppressDynamicIndexerAccessOffOfType_02() + { + var iLSource = @" +.class public auto ansi WithIndexer + extends [mscorlib]System.Object +{ + .method public specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method WithIndexer::.ctor + + .method public specialname static object + get_Indexer(object x, + object y) cil managed + { + // Code size 18 (0x12) + .maxstack 1 + .locals init (object V_0) + IL_0000: nop + IL_0001: ldstr ""Indexer"" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldnull + IL_000d: stloc.0 + IL_000e: br.s IL_0010 + + IL_0010: ldloc.0 + IL_0011: ret + } // end of method WithIndexer::get_Indexer + + .method public specialname static void + set_Indexer(object x, + object y, + object 'value') cil managed + { + // Code size 2 (0x2) + .maxstack 8 + IL_0000: nop + IL_0001: ret + } // end of method WithIndexer::set_Indexer + + .method public static object MIndexer(object x, + object y) cil managed + { + // Code size 18 (0x12) + .maxstack 1 + .locals init (object V_0) + IL_0000: nop + IL_0001: ldstr ""MIndexer"" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldnull + IL_000d: stloc.0 + IL_000e: br.s IL_0010 + + IL_0010: ldloc.0 + IL_0011: ret + } // end of method WithIndexer::MIndexer + + .property object Indexer(object, + object) + { + .get object WithIndexer::get_Indexer(object, + object) + .set void WithIndexer::set_Indexer(object, + object, + object) + } // end of property WithIndexer::Indexer +} // end of class WithIndexer +"; + + MetadataReference reference = CompileIL(iLSource, appendDefaultHeader: true, embedInteropTypes: false); + + string consumer1 = @" +class Test +{ + public static void Main() + { + dynamic x = 1; + dynamic y = 1; + var z2 = WithIndexer.MIndexer(x, y); + } +}"; + + var compilation1 = CreateCompilationWithMscorlib(consumer1, options: TestOptions.ReleaseExe, + references: new MetadataReference[] { reference, CSharpRef, SystemCoreRef }); + + CompileAndVerify(compilation1, expectedOutput: "MIndexer").VerifyDiagnostics(); + + string consumer2 = @" +class Test +{ + public static void Main() + { + dynamic x = 1; + dynamic y = 1; + var z1 = WithIndexer.Indexer[x, y]; + } +}"; + + var compilation2 = CreateCompilationWithMscorlib(consumer2, options: TestOptions.ReleaseExe, + references: new MetadataReference[] { reference, CSharpRef, SystemCoreRef }); + + compilation2.VerifyDiagnostics( + // (8,30): error CS1545: Property, indexer, or event 'WithIndexer.Indexer[object, object]' is not supported by the language; try directly calling accessor methods 'WithIndexer.get_Indexer(object, object)' or 'WithIndexer.set_Indexer(object, object, object)' + // var z1 = WithIndexer.Indexer[x, y]; + Diagnostic(ErrorCode.ERR_BindToBogusProp2, "Indexer").WithArguments("WithIndexer.Indexer[object, object]", "WithIndexer.get_Indexer(object, object)", "WithIndexer.set_Indexer(object, object, object)").WithLocation(8, 30) + ); + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs index f95152ced1bfd..4ec87e0899a26 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/QueryTests.cs @@ -2094,5 +2094,152 @@ where x.ToString() == y.ToString() Diagnostic(ErrorCode.ERR_UnsupportedTransparentIdentifierAccess, "x").WithArguments("x", "int") ); } + + [Fact] + [WorkItem(204561, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=204561&_a=edit")] + public void Bug204561_01() + { + string sourceCode = +@" +class C +{ + public static void Main() + { + var x01 = from a in Test select a + 1; + } +} + +public class Test +{ +} + +public static class TestExtensions +{ + public static Test Select(this Test x, System.Func selector) + { + return null; + } +} +"; + var compilation = CreateCompilationWithMscorlibAndSystemCore(sourceCode); + + compilation.VerifyDiagnostics( + // (6,34): error CS1936: Could not find an implementation of the query pattern for source type 'Test'. 'Select' not found. + // var x01 = from a in Test select a + 1; + Diagnostic(ErrorCode.ERR_QueryNoProvider, "select a + 1").WithArguments("Test", "Select").WithLocation(6, 34) + ); + } + + [Fact] + [WorkItem(204561, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=204561&_a=edit")] + public void Bug204561_02() + { + string sourceCode = +@" +class C +{ + public static void Main() + { + var y02 = from a in Test select a + 1; + var x02 = from a in Test where a > 0 select a + 1; + } +} + +class Test +{ + public static Test Select(System.Func selector) + { + return null; + } +} + +static class TestExtensions +{ + public static Test Where(this Test x, System.Func filter) + { + return null; + } +}"; + var compilation = CreateCompilationWithMscorlibAndSystemCore(sourceCode); + + compilation.VerifyDiagnostics( + // (7,34): error CS1936: Could not find an implementation of the query pattern for source type 'Test'. 'Where' not found. + // var x02 = from a in Test where a > 0 select a + 1; + Diagnostic(ErrorCode.ERR_QueryNoProvider, "where a > 0").WithArguments("Test", "Where").WithLocation(7, 34), + // (7,46): error CS0176: Member 'Test.Select(Func)' cannot be accessed with an instance reference; qualify it with a type name instead + // var x02 = from a in Test where a > 0 select a + 1; + Diagnostic(ErrorCode.ERR_ObjectProhibited, "select a + 1").WithArguments("Test.Select(System.Func)").WithLocation(7, 46) + ); + } + + [Fact] + [WorkItem(204561, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=204561&_a=edit")] + public void Bug204561_03() + { + string sourceCode = +@" +class C +{ + public static void Main() + { + var y03 = from a in Test select a + 1; + var x03 = from a in Test where a > 0 select a + 1; + } +} + +class Test +{ +} + +static class TestExtensions +{ + public static Test Select(this Test x, System.Func selector) + { + return null; + } + + public static Test Where(this Test x, System.Func filter) + { + return null; + } +}"; + var compilation = CreateCompilationWithMscorlibAndSystemCore(sourceCode); + + compilation.VerifyDiagnostics( + // (6,34): error CS1936: Could not find an implementation of the query pattern for source type 'Test'. 'Select' not found. + // var y03 = from a in Test select a + 1; + Diagnostic(ErrorCode.ERR_QueryNoProvider, "select a + 1").WithArguments("Test", "Select").WithLocation(6, 34), + // (7,34): error CS1936: Could not find an implementation of the query pattern for source type 'Test'. 'Where' not found. + // var x03 = from a in Test where a > 0 select a + 1; + Diagnostic(ErrorCode.ERR_QueryNoProvider, "where a > 0").WithArguments("Test", "Where").WithLocation(7, 34) + ); + } + + [Fact] + [WorkItem(204561, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=204561&_a=edit")] + public void Bug204561_04() + { + string sourceCode = +@" +class C +{ + public static void Main() + { + var x04 = from a in Test select a + 1; + } +} + +class Test +{ + public static Test Select(System.Func selector) + { + System.Console.WriteLine(""Select""); + return null; + } +}"; + var compilation = CreateCompilationWithMscorlibAndSystemCore(sourceCode, options: TestOptions.DebugExe); + + CompileAndVerify(compilation, expectedOutput: "Select"); + } } } diff --git a/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs b/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs index 5918d360eddd1..d4172d6e32587 100644 --- a/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs @@ -116,19 +116,17 @@ partial class D Assert.Equal(0, d2.Children.Length); var table = DeclarationTable.Empty; - Assert.Empty(table.AllRootNamespacesUnordered()); - - var mr = table.MergedRoot; + var mr = table.CalculateMergedRoot(null); Assert.NotNull(mr); + Assert.True(mr.Declarations.IsEmpty); Assert.True(table.TypeNames.IsEmpty()); table = table.AddRootDeclaration(Lazy(decl1)); + mr = table.CalculateMergedRoot(null); - Assert.Equal(decl1, table.AllRootNamespacesUnordered().Single()); + Assert.Equal(mr.Declarations, new[] { decl1 }); Assert.True(table.TypeNames.OrderBy(s => s).SequenceEqual(new[] { "C", "D" })); - mr = table.MergedRoot; - Assert.Equal(DeclarationKind.Namespace, mr.Kind); Assert.Equal(string.Empty, mr.Name); @@ -156,12 +154,11 @@ partial class D Assert.Equal("D", d.Name); table = table.AddRootDeclaration(Lazy(decl2)); + mr = table.CalculateMergedRoot(null); Assert.True(table.TypeNames.Distinct().OrderBy(s => s).SequenceEqual(new[] { "C", "D" })); - Assert.Equal(2, table.AllRootNamespacesUnordered().Intersect(new[] { decl1, decl2 }).Count()); - - mr = table.MergedRoot; + Assert.Equal(mr.Declarations, new[] { decl1, decl2 }); Assert.Equal(DeclarationKind.Namespace, mr.Kind); Assert.Equal(string.Empty, mr.Name); diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/Source/DeclaringSyntaxNodeTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/Source/DeclaringSyntaxNodeTests.cs index e5d47d3f03b91..be8c2eee2ee9c 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/Source/DeclaringSyntaxNodeTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/Source/DeclaringSyntaxNodeTests.cs @@ -718,5 +718,47 @@ void f() CheckLambdaDeclaringSyntax(comp, tree, "/*2*/"); CheckLambdaDeclaringSyntax(comp, tree, "/*3*/"); } + + /// + /// Symbol location order should be preserved when trees + /// are replaced in the compilation. + /// + [WorkItem(11015, "https://github.com/dotnet/roslyn/issues/11015")] + [Fact] + public void PreserveLocationOrderOnReplaceSyntaxTree() + { + var source0 = Parse("namespace N { partial class C { } } namespace N0 { } class C0 { }"); + var source1 = Parse("namespace N { partial class C { } } namespace N1 { } class C1 { }"); + var source2 = Parse("namespace N { struct S { } }"); + var source3 = Parse("namespace N { partial class C { } } namespace N3 { } class C3 { }"); + var comp0 = CreateCompilationWithMscorlib(new[] { source0, source1, source2, source3 }); + comp0.VerifyDiagnostics(); + Assert.Equal(new[] { source0, source1, source2, source3 }, comp0.SyntaxTrees); + + // Location order of partial class should match SyntaxTrees order. + var locations = comp0.GetMember("N.C").Locations; + Assert.Equal(new[] { source0, source1, source3 }, locations.Select(l => l.SourceTree)); + + // AddSyntaxTrees will add to the end. + var source4 = Parse("namespace N { partial class C { } } namespace N4 { } class C4 { }"); + var comp1 = comp0.AddSyntaxTrees(source4); + locations = comp1.GetMember("N.C").Locations; + Assert.Equal(new[] { source0, source1, source3, source4 }, locations.Select(l => l.SourceTree)); + + // ReplaceSyntaxTree should preserve location order. + var comp2 = comp0.ReplaceSyntaxTree(source1, source4); + locations = comp2.GetMember("N.C").Locations; + Assert.Equal(new[] { source0, source4, source3 }, locations.Select(l => l.SourceTree)); + + // NamespaceNames and TypeNames do not match SyntaxTrees order. + // This is expected. + Assert.Equal(new[] { "", "N3", "N0", "N", "", "N4", "N" }, comp2.Declarations.NamespaceNames.ToArray()); + Assert.Equal(new[] { "C3", "C0", "S", "C", "C4", "C" }, comp2.Declarations.TypeNames.ToArray()); + + // RemoveSyntaxTrees should preserve order of remaining trees. + var comp3 = comp2.RemoveSyntaxTrees(source0); + locations = comp3.GetMember("N.C").Locations; + Assert.Equal(new[] { source4, source3 }, locations.Select(l => l.SourceTree)); + } } } diff --git a/src/Compilers/Core/MSBuildTask/Portable/project.json b/src/Compilers/Core/MSBuildTask/Portable/project.json index 9b90e3eefce28..7b249ce3b9c6f 100644 --- a/src/Compilers/Core/MSBuildTask/Portable/project.json +++ b/src/Compilers/Core/MSBuildTask/Portable/project.json @@ -1,17 +1,18 @@ { "dependencies": { "Microsoft.NETCore.Portable.Compatibility": "1.0.0", - "Microsoft.NETCore.Platforms": "1.0.0", + "Microsoft.NETCore.Platforms": "1.0.1-rc3-24128-00", + "Microsoft.Build.Framework": "0.1.0-preview-00005", "Microsoft.Build.Tasks.Core": "0.1.0-preview-00005", "Microsoft.Build.Utilities.Core": "0.1.0-preview-00005", "Microsoft.Win32.Primitives": "4.0.0", - "System.Console": "4.0.0-rc3-24102-00", + "System.Console": "4.0.0-rc3-24128-00", "System.Diagnostics.Tools": "4.0.0", - "System.Diagnostics.Process": "4.1.0-rc3-24102-00", - "System.IO.Pipes": "4.0.0-rc3-24102-00", - "System.Runtime.InteropServices.RuntimeInformation": "4.0.0-rc3-24102-00", - "System.IO.FileSystem": "4.0.1-rc3-24102-00", - "System.IO.FileSystem.DriveInfo": "4.0.0-rc3-24102-00" + "System.Diagnostics.Process": "4.1.0-rc3-24128-00", + "System.IO.Pipes": "4.0.0-rc3-24128-00", + "System.Runtime.InteropServices.RuntimeInformation": "4.0.0-rc3-24128-00", + "System.IO.FileSystem": "4.0.1-rc3-24128-00", + "System.IO.FileSystem.DriveInfo": "4.0.0-rc3-24128-00" }, "frameworks": { "netstandard1.3": { diff --git a/src/Compilers/Core/MSBuildTask/Shared/ManagedCompiler.cs b/src/Compilers/Core/MSBuildTask/Shared/ManagedCompiler.cs index 28e140ea47817..05c82577fe2ec 100644 --- a/src/Compilers/Core/MSBuildTask/Shared/ManagedCompiler.cs +++ b/src/Compilers/Core/MSBuildTask/Shared/ManagedCompiler.cs @@ -60,6 +60,12 @@ public ITaskItem[] Analyzers // We do not support BugReport because it always requires user interaction, // which will cause a hang. + public string ChecksumAlgorithm + { + set { _store[nameof(ChecksumAlgorithm)] = value; } + get { return (string)_store[nameof(ChecksumAlgorithm)]; } + } + public string CodeAnalysisRuleSet { set { _store[nameof(CodeAnalysisRuleSet)] = value; } @@ -698,6 +704,7 @@ internal void AddResponseFileCommandsForSwitchesSinceInitialReleaseThatAreNeeded commandLine.AppendPlusOrMinusSwitch("/deterministic", _store, nameof(Deterministic)); commandLine.AppendPlusOrMinusSwitch("/publicsign", _store, nameof(PublicSign)); commandLine.AppendSwitchIfNotNull("/runtimemetadataversion:", RuntimeMetadataVersion); + commandLine.AppendSwitchIfNotNull("/checksumalgorithm:", ChecksumAlgorithm); AddFeatures(commandLine, Features); } diff --git a/src/Compilers/Core/MSBuildTask/Shared/Microsoft.CSharp.Core.targets b/src/Compilers/Core/MSBuildTask/Shared/Microsoft.CSharp.Core.targets index eb5cad044167b..bf0c1afd973b6 100644 --- a/src/Compilers/Core/MSBuildTask/Shared/Microsoft.CSharp.Core.targets +++ b/src/Compilers/Core/MSBuildTask/Shared/Microsoft.CSharp.Core.targets @@ -73,6 +73,7 @@ ApplicationConfiguration="$(AppConfigForCompiler)" BaseAddress="$(BaseAddress)" CheckForOverflowUnderflow="$(CheckForOverflowUnderflow)" + ChecksumAlgorithm="$(ChecksumAlgorithm)" CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)" CodePage="$(CodePage)" DebugType="$(DebugType)" diff --git a/src/Compilers/Core/MSBuildTask/Shared/Microsoft.VisualBasic.Core.targets b/src/Compilers/Core/MSBuildTask/Shared/Microsoft.VisualBasic.Core.targets index 1b816aa08122b..e6de1582a43d0 100644 --- a/src/Compilers/Core/MSBuildTask/Shared/Microsoft.VisualBasic.Core.targets +++ b/src/Compilers/Core/MSBuildTask/Shared/Microsoft.VisualBasic.Core.targets @@ -59,6 +59,7 @@ AdditionalFiles="@(AdditionalFiles)" Analyzers="@(Analyzer)" BaseAddress="$(BaseAddress)" + ChecksumAlgorithm="$(ChecksumAlgorithm)" CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)" CodePage="$(CodePage)" DebugType="$(DebugType)" diff --git a/src/Compilers/Core/MSBuildTaskTests/CscTests.cs b/src/Compilers/Core/MSBuildTaskTests/CscTests.cs index 093e9d18a789b..084459bd13076 100644 --- a/src/Compilers/Core/MSBuildTaskTests/CscTests.cs +++ b/src/Compilers/Core/MSBuildTaskTests/CscTests.cs @@ -90,6 +90,25 @@ public void RuntimeMetadataVersionFlag() Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents()); } + [Fact] + public void ChecksumAlgorithmOption() + { + var csc = new Csc(); + csc.Sources = MSBuildUtil.CreateTaskItems("test.cs"); + csc.ChecksumAlgorithm = "sha256"; + Assert.Equal("/out:test.exe /checksumalgorithm:sha256 test.cs", csc.GenerateResponseFileContents()); + + csc = new Csc(); + csc.Sources = MSBuildUtil.CreateTaskItems("test.cs"); + csc.ChecksumAlgorithm = null; + Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents()); + + csc = new Csc(); + csc.Sources = MSBuildUtil.CreateTaskItems("test.cs"); + csc.ChecksumAlgorithm = ""; + Assert.Equal("/out:test.exe /checksumalgorithm: test.cs", csc.GenerateResponseFileContents()); + } + [Fact] public void TargetTypeDll() { diff --git a/src/Compilers/Core/MSBuildTaskTests/VbcTests.cs b/src/Compilers/Core/MSBuildTaskTests/VbcTests.cs index 7d0800e637751..27756f9b25c13 100644 --- a/src/Compilers/Core/MSBuildTaskTests/VbcTests.cs +++ b/src/Compilers/Core/MSBuildTaskTests/VbcTests.cs @@ -87,6 +87,25 @@ public void RuntimeMetadataVersionFlag() Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents()); } + [Fact] + public void ChecksumAlgorithmOption() + { + var vbc = new Vbc(); + vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb"); + vbc.ChecksumAlgorithm = "sha256"; + Assert.Equal("/optionstrict:custom /out:test.exe /checksumalgorithm:sha256 test.vb", vbc.GenerateResponseFileContents()); + + vbc = new Vbc(); + vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb"); + vbc.ChecksumAlgorithm = null; + Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents()); + + vbc = new Vbc(); + vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb"); + vbc.ChecksumAlgorithm = ""; + Assert.Equal("/optionstrict:custom /out:test.exe /checksumalgorithm: test.vb", vbc.GenerateResponseFileContents()); + } + [Fact] public void TargetTypeDll() { diff --git a/src/Compilers/Server/PortableServer/project.json b/src/Compilers/Server/PortableServer/project.json index 7a792911bbc63..ba94bd3e4a94d 100644 --- a/src/Compilers/Server/PortableServer/project.json +++ b/src/Compilers/Server/PortableServer/project.json @@ -1,7 +1,7 @@ { "dependencies": { }, "frameworks": { - "dnxcore50": { + "NETCoreApp1.0": { "imports": "portable-net452" } }, diff --git a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb index 91c315d9b9a89..6c21b1d68538d 100644 --- a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb +++ b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb @@ -192,6 +192,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Get End Property + Friend ReadOnly Property MergedRootDeclaration As MergedNamespaceDeclaration + Get + Return Declarations.GetMergedRoot(Me) + End Get + End Property + Public Shadows ReadOnly Property Options As VisualBasicCompilationOptions Get Return _options @@ -2627,7 +2633,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Throw New ArgumentException(VBResources.NoNoneSearchCriteria, NameOf(filter)) End If - Return Me.Declarations.ContainsName(predicate, filter, cancellationToken) + Return DeclarationTable.ContainsName(MergedRootDeclaration, predicate, filter, cancellationToken) End Function ''' @@ -2660,7 +2666,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim result = New HashSet(Of ISymbol)() Dim spine = New List(Of MergedNamespaceOrTypeDeclaration)() - AppendSymbolsWithName(spine, Me._compilation.Declarations.MergedRoot, predicate, filter, result, cancellationToken) + AppendSymbolsWithName(spine, _compilation.MergedRootDeclaration, predicate, filter, result, cancellationToken) Return result End Function diff --git a/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTable.vb b/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTable.vb index 1f513545db47d..7198639f43019 100644 --- a/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTable.vb +++ b/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTable.vb @@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Private ReadOnly _cache As Cache ' The lazily computed total merged declaration. - Private ReadOnly _mergedRoot As Lazy(Of MergedNamespaceDeclaration) + Private _mergedRoot As MergedNamespaceDeclaration Private ReadOnly _typeNames As Lazy(Of ICollection(Of String)) Private ReadOnly _namespaceNames As Lazy(Of ICollection(Of String)) @@ -58,7 +58,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Me._allOlderRootDeclarations = allOlderRootDeclarations Me._latestLazyRootDeclaration = latestLazyRootDeclaration Me._cache = If(cache, New Cache(Me)) - Me._mergedRoot = New Lazy(Of MergedNamespaceDeclaration)(AddressOf GetMergedRoot) Me._typeNames = New Lazy(Of ICollection(Of String))(AddressOf GetMergedTypeNames) Me._namespaceNames = New Lazy(Of ICollection(Of String))(AddressOf GetMergedNamespaceNames) Me._referenceDirectives = New Lazy(Of ICollection(Of ReferenceDirective))(AddressOf GetMergedReferenceDirectives) @@ -140,7 +139,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ' old merged root new merged root ' / | | | \ \ ' old singles forest new single tree - Private Function GetMergedRoot() As MergedNamespaceDeclaration + Public Function GetMergedRoot(compilation As VisualBasicCompilation) As MergedNamespaceDeclaration + Debug.Assert(compilation.Declarations Is Me) + If _mergedRoot Is Nothing Then + Interlocked.CompareExchange(_mergedRoot, CalculateMergedRoot(compilation), Nothing) + End If + Return _mergedRoot + End Function + + ' Internal for unit tests only. + Friend Function CalculateMergedRoot(compilation As VisualBasicCompilation) As MergedNamespaceDeclaration Dim oldRoot = Me._cache.MergedRoot.Value Dim latestRoot = GetLatestRootDeclarationIfAny(includeEmbedded:=True) If latestRoot Is Nothing Then @@ -148,10 +156,32 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ElseIf oldRoot Is Nothing Then Return MergedNamespaceDeclaration.Create(latestRoot) Else - Return MergedNamespaceDeclaration.Create(oldRoot, latestRoot) + Dim oldRootDeclarations = oldRoot.Declarations + Dim builder = ArrayBuilder(Of SingleNamespaceDeclaration).GetInstance(oldRootDeclarations.Length + 1) + builder.AddRange(oldRootDeclarations) + builder.Add(_latestLazyRootDeclaration.Root.Value) + ' Sort the root namespace declarations to match the order of SyntaxTrees. + If compilation IsNot Nothing Then + builder.Sort(New RootNamespaceLocationComparer(compilation)) + End If + Return MergedNamespaceDeclaration.Create(builder.ToImmutableAndFree()) End If End Function + Private NotInheritable Class RootNamespaceLocationComparer + Implements IComparer(Of SingleNamespaceDeclaration) + + Private ReadOnly _compilation As VisualBasicCompilation + + Friend Sub New(compilation As VisualBasicCompilation) + _compilation = compilation + End Sub + + Public Function Compare(x As SingleNamespaceDeclaration, y As SingleNamespaceDeclaration) As Integer Implements IComparer(Of SingleNamespaceDeclaration).Compare + Return _compilation.CompareSourceLocations(x.Location, y.Location) + End Function + End Class + Private Function GetMergedTypeNames() As ICollection(Of String) Dim cachedTypeNames = Me._cache.TypeNames.Value Dim latestRoot = GetLatestRootDeclarationIfAny(includeEmbedded:=True) @@ -222,12 +252,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Return result.AsCaseInsensitiveCollection() End Function - Public ReadOnly Property MergedRoot As MergedNamespaceDeclaration - Get - Return _mergedRoot.Value - End Get - End Property - Public ReadOnly Property TypeNames As ICollection(Of String) Get Return _typeNames.Value @@ -246,14 +270,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property - Public Function ContainsName(predicate As Func(Of String, Boolean), filter As SymbolFilter, cancellationToken As CancellationToken) As Boolean + Public Shared Function ContainsName( + mergedRoot As MergedNamespaceDeclaration, + predicate As Func(Of String, Boolean), + filter As SymbolFilter, + cancellationToken As CancellationToken) As Boolean Dim includeNamespace = (filter And SymbolFilter.Namespace) = SymbolFilter.Namespace Dim includeType = (filter And SymbolFilter.Type) = SymbolFilter.Type Dim includeMember = (filter And SymbolFilter.Member) = SymbolFilter.Member Dim stack = New Stack(Of MergedNamespaceOrTypeDeclaration)() - stack.Push(Me.MergedRoot) + stack.Push(mergedRoot) While stack.Count > 0 cancellationToken.ThrowIfCancellationRequested() diff --git a/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb b/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb index 6d093535fdb7c..d4bf44136eee8 100644 --- a/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb +++ b/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb @@ -29,11 +29,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Return New MergedNamespaceDeclaration(declarations.AsImmutableOrNull) End Function - Public Shared Function Create(mergedDeclaration As MergedNamespaceDeclaration, - declaration As SingleNamespaceDeclaration) As MergedNamespaceDeclaration - Return New MergedNamespaceDeclaration(mergedDeclaration._declarations.Add(declaration)) - End Function - Public Overrides ReadOnly Property Kind As DeclarationKind Get Return DeclarationKind.Namespace diff --git a/src/Compilers/VisualBasic/Portable/Declarations/SingleNamespaceDeclaration.vb b/src/Compilers/VisualBasic/Portable/Declarations/SingleNamespaceDeclaration.vb index 816557e0c9fda..80818b4287cb6 100644 --- a/src/Compilers/VisualBasic/Portable/Declarations/SingleNamespaceDeclaration.vb +++ b/src/Compilers/VisualBasic/Portable/Declarations/SingleNamespaceDeclaration.vb @@ -5,11 +5,6 @@ Imports System.Collections.Generic Imports System.Collections.Immutable Imports System.Diagnostics Imports System.Linq -Imports System.Text -Imports System.Threading -Imports Microsoft.CodeAnalysis.Collections -Imports Microsoft.CodeAnalysis.Text -Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.vb b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.vb index ab5776c7409ed..b77119b6355cf 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.vb @@ -96,10 +96,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End If If node.RelaxationLambdaOpt IsNot Nothing Then - returnValue = node.Update(VisitExpressionNode(node.RelaxationLambdaOpt), - node.ConversionKind, node.Checked, node.ExplicitCastInCode, - node.ConstantValueOpt, node.ConstructorOpt, - relaxationLambdaOpt:=Nothing, relaxationReceiverPlaceholderOpt:=Nothing, type:=node.Type) + returnValue = RewriteLambdaRelaxationConversion(node) ElseIf node.ConversionKind = ConversionKind.InterpolatedString Then returnValue = RewriteInterpolatedStringConversion(node) @@ -115,6 +112,88 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return returnValue End Function + Private Function RewriteLambdaRelaxationConversion(node As BoundConversion) As BoundNode + Dim returnValue As BoundNode + + If _inExpressionLambda AndAlso + NoParameterRelaxation(node.Operand, node.RelaxationLambdaOpt.LambdaSymbol) Then + + ' COMPAT: skip relaxation in this case. ET can drop the return value of the inner lambda. + returnValue = MyBase.VisitConversion( + node.Update(node.Operand, + node.ConversionKind, node.Checked, node.ExplicitCastInCode, + node.ConstantValueOpt, node.ConstructorOpt, + relaxationLambdaOpt:=Nothing, relaxationReceiverPlaceholderOpt:=Nothing, type:=node.Type)) + + returnValue = TransformRewrittenConversion(DirectCast(returnValue, BoundConversion)) + Else + returnValue = node.Update(VisitExpressionNode(node.RelaxationLambdaOpt), + node.ConversionKind, node.Checked, node.ExplicitCastInCode, + node.ConstantValueOpt, node.ConstructorOpt, + relaxationLambdaOpt:=Nothing, relaxationReceiverPlaceholderOpt:=Nothing, type:=node.Type) + End If + + Return returnValue + End Function + + Private Function RewriteLambdaRelaxationConversion(node As BoundDirectCast) As BoundNode + Dim returnValue As BoundNode + + If _inExpressionLambda AndAlso + NoParameterRelaxation(node.Operand, node.RelaxationLambdaOpt.LambdaSymbol) Then + + ' COMPAT: skip relaxation in this case. ET can drop the return value of the inner lambda. + returnValue = MyBase.VisitDirectCast( + node.Update(node.Operand, + node.ConversionKind, node.SuppressVirtualCalls, + node.ConstantValueOpt, + relaxationLambdaOpt:=Nothing, type:=node.Type)) + + Else + returnValue = node.Update(VisitExpressionNode(node.RelaxationLambdaOpt), + node.ConversionKind, node.SuppressVirtualCalls, + node.ConstantValueOpt, + relaxationLambdaOpt:=Nothing, type:=node.Type) + End If + + Return returnValue + End Function + + Private Function RewriteLambdaRelaxationConversion(node As BoundTryCast) As BoundNode + Dim returnValue As BoundNode + + If _inExpressionLambda AndAlso + NoParameterRelaxation(node.Operand, node.RelaxationLambdaOpt.LambdaSymbol) Then + + ' COMPAT: skip relaxation in this case. ET can drop the return value of the inner lambda. + returnValue = MyBase.VisitTryCast( + node.Update(node.Operand, + node.ConversionKind, + node.ConstantValueOpt, + relaxationLambdaOpt:=Nothing, type:=node.Type)) + + Else + returnValue = node.Update(VisitExpressionNode(node.RelaxationLambdaOpt), + node.ConversionKind, + node.ConstantValueOpt, + relaxationLambdaOpt:=Nothing, type:=node.Type) + End If + + Return returnValue + End Function + + Private Shared Function NoParameterRelaxation(from As BoundExpression, toLambda As LambdaSymbol) As Boolean + Dim fromLambda As LambdaSymbol = TryCast(from, BoundLambda)?.LambdaSymbol + + ' are we are relaxing for the purpose of dropping return? + Return fromLambda IsNot Nothing AndAlso + Not fromLambda.IsSub AndAlso + toLambda.IsSub AndAlso + MethodSignatureComparer.HaveSameParameterTypes(fromLambda.Parameters, Nothing, toLambda.Parameters, Nothing, considerByRef:=True, considerCustomModifiers:=False) + + End Function + + ' Rewrite Anonymous Delegate conversion into a delegate creation Private Function RewriteAnonymousDelegateConversion(node As BoundConversion) As BoundNode Debug.Assert(Not Conversions.IsIdentityConversion(node.ConversionKind)) @@ -1198,9 +1277,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic If node.RelaxationLambdaOpt Is Nothing Then returnValue = MyBase.VisitDirectCast(node) Else - returnValue = node.Update(VisitExpressionNode(node.RelaxationLambdaOpt), - node.ConversionKind, node.SuppressVirtualCalls, node.ConstantValueOpt, - relaxationLambdaOpt:=Nothing, type:=node.Type) + returnValue = RewriteLambdaRelaxationConversion(node) End If _inExpressionLambda = wasInExpressionlambda @@ -1250,9 +1327,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End If Else - returnValue = node.Update(VisitExpressionNode(node.RelaxationLambdaOpt), - node.ConversionKind, node.ConstantValueOpt, - relaxationLambdaOpt:=Nothing, type:=node.Type) + returnValue = RewriteLambdaRelaxationConversion(node) End If _inExpressionLambda = wasInExpressionlambda diff --git a/src/Compilers/VisualBasic/Portable/Symbols/LexicalSortKey.vb b/src/Compilers/VisualBasic/Portable/Symbols/LexicalSortKey.vb index c2a42800b0bf8..6590cb350d1fc 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/LexicalSortKey.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/LexicalSortKey.vb @@ -112,7 +112,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Else Debug.Assert(location.PossiblyEmbeddedOrMySourceSpan.Start >= 0) - Dim tree = DirectCast(location.SourceTree, VisualBasicSyntaxTree) + Dim tree = DirectCast(location.PossiblyEmbeddedOrMySourceTree, VisualBasicSyntaxTree) Debug.Assert(tree Is Nothing OrElse tree.GetEmbeddedKind = location.EmbeddedKind) Dim treeKind As SyntaxTreeKind = GetEmbeddedKind(tree) diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb index fcda9383c6c9f..5909c8c6260af 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb @@ -461,8 +461,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Friend Function GetAttributeDeclarations() As ImmutableArray(Of SyntaxList(Of AttributeListSyntax)) Dim attributeBlocks = ArrayBuilder(Of SyntaxList(Of AttributeListSyntax)).GetInstance() + Dim declarations = DeclaringCompilation.MergedRootDeclaration.Declarations - For Each rootNs In DeclaringCompilation.Declarations.AllRootNamespaces + For Each rootNs As RootSingleNamespaceDeclaration In declarations If rootNs.HasAssemblyAttributes Then Dim compilationUnitSyntax = DirectCast(rootNs.Location.SourceTree.GetRoot(), CompilationUnitSyntax) Dim attributeStatements = compilationUnitSyntax.Attributes diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb index 50071d2983ba4..e46d429c8969c 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceModuleSymbol.vb @@ -102,9 +102,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Get Select Case DeclaringCompilation.Options.Platform Case Platform.Arm - Return System.Reflection.PortableExecutable.Machine.ARMThumb2 + Return System.Reflection.PortableExecutable.Machine.ArmThumb2 Case Platform.X64 - Return System.Reflection.PortableExecutable.Machine.AMD64 + Return System.Reflection.PortableExecutable.Machine.Amd64 Case Platform.Itanium Return System.Reflection.PortableExecutable.Machine.IA64 Case Else @@ -172,7 +172,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Public Overrides ReadOnly Property GlobalNamespace As NamespaceSymbol Get If _lazyGlobalNamespace Is Nothing Then - Dim globalNS = New SourceNamespaceSymbol(_declarationTable.MergedRoot, Nothing, Me) + Dim globalNS = New SourceNamespaceSymbol(DeclaringCompilation.MergedRootDeclaration, Nothing, Me) Interlocked.CompareExchange(_lazyGlobalNamespace, globalNS, Nothing) End If @@ -193,9 +193,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location) Get If _locations.IsDefault Then - Dim locs = _declarationTable.AllRootNamespaces().SelectAsArray(Function(n) n.Location) - - ImmutableInterlocked.InterlockedCompareExchange(_locations, locs, Nothing) + ImmutableInterlocked.InterlockedInitialize( + _locations, + DeclaringCompilation.MergedRootDeclaration.Declarations.SelectAsArray(Function(d) d.Location)) End If Return _locations diff --git a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb index 3eb523e992682..80f57c6c9c1b5 100644 --- a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb +++ b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb @@ -2807,6 +2807,451 @@ Lambda( ]]>) End Sub + + Public Sub Relaxation01() + Dim file = + + TestExpressionTrees(file, + c.ProcessSub() +c => c.Process() +]]>) + End Sub + + + + Public Sub Relaxation02() + Dim file = + + TestExpressionTrees(file, + ProcessSub(ConvertChecked(c)) +c => Process(ConvertChecked(c)) +]]>) + End Sub + + + Public Sub Relaxation03() + Dim file = + + TestExpressionTrees(file, + ProcessSub() +c => Process() +]]>) + End Sub + + + Public Sub Relaxation04() + Dim file = + + TestExpressionTrees(file, + Invoke(() => ProcessSub()) +a0 => Invoke(() => Process()) +]]>) + End Sub + + + Public Sub Relaxation05() + Dim file = + + TestExpressionTrees(file, + ProcessSub(tt => ProcessSub(null)) +t => Process(tt => Process(null)) +]]>) + End Sub + + + Public Sub Relaxation05ET() + Dim file = + + TestExpressionTrees(file, + ProcessSub(tt => ProcessSub(null)) +t => Process(tt => Process(null)) +]]>) + End Sub + + + Public Sub Relaxation06() + Dim file = + + TestExpressionTrees(file, + ProcessSub(tt => ProcessSub(null)) +t => Process(tt => Process(null)) +]]>) + End Sub + + + Public Sub Relaxation07() + Dim file = + + TestExpressionTrees(file, + ProcessSub(tt => ProcessSub(null)) +t => Process(tt => Process(null)) +]]>) + End Sub + + + Public Sub Relaxation08() + Dim file = + + TestExpressionTrees(file, + M1(a0 => Invoke(value(C1`1+_Closure$__1-0[System.String]).$VB$Local_anonymousDelegate, a0)) +]]>) + End Sub + + #End Region #Region "Xml Literals" diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb index 312a0cc322ed9..1da9cb85cdd1e 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb @@ -195,16 +195,6 @@ End Class compilation.VerifyPdb( - - - - - - - - - - @@ -215,6 +205,17 @@ End Class + + + + + + + + + + + @@ -279,15 +280,14 @@ End Class - + - - - - + + + - - + + @@ -302,7 +302,7 @@ End Class - + @@ -318,7 +318,7 @@ End Class - + @@ -334,7 +334,7 @@ End Class - + @@ -350,7 +350,7 @@ End Class - + @@ -371,7 +371,7 @@ End Class - + @@ -382,7 +382,7 @@ End Class - + @@ -392,7 +392,7 @@ End Class - + @@ -411,7 +411,7 @@ End Class - + @@ -422,7 +422,7 @@ End Class - + @@ -3871,26 +3871,6 @@ End Class compilation.VerifyPdb( - - - - - - - - - - - - - - - - - - - - @@ -3901,6 +3881,17 @@ End Class + + + + + + + + + + + @@ -3965,15 +3956,24 @@ End Class - + - - - - + + + - - + + + + + + + + + + + + @@ -3988,7 +3988,7 @@ End Class - + @@ -4004,7 +4004,7 @@ End Class - + @@ -4020,7 +4020,7 @@ End Class - + @@ -4036,7 +4036,7 @@ End Class - + @@ -4057,7 +4057,7 @@ End Class - + @@ -4068,7 +4068,7 @@ End Class - + @@ -4078,7 +4078,7 @@ End Class - + @@ -4097,7 +4097,7 @@ End Class - + @@ -4108,7 +4108,7 @@ End Class - + diff --git a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Source/SourceSymbolTests.vb b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Source/SourceSymbolTests.vb index 34adb5da509d2..d2fe80610888e 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Source/SourceSymbolTests.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Source/SourceSymbolTests.vb @@ -606,5 +606,85 @@ BC31060: event 'E' implicitly defines 'add_E', which conflicts with a member of Assert.Equal("Add_E", members(3).MetadataName) End Sub + ''' + ''' Symbol location order should be preserved when trees + ''' are replaced in the compilation. + ''' + + + Public Sub PreserveLocationOrderOnReplaceSyntaxTree() + Dim source0 = Parse( +"Namespace N + Partial Class C + End Class +End Namespace +Namespace N0 + Class C0 + End Class +End Namespace") + Dim source1 = Parse( +"Namespace N + Partial Class C + End Class +End Namespace +Namespace N1 + Class C1 + End Class +End Namespace") + Dim source2 = Parse( +"Namespace N + Structure S + End Structure +End Namespace") + Dim source3 = Parse( +"Namespace N + Partial Class C + End Class +End Namespace +Namespace N3 + Class C3 + End Class +End Namespace") + Dim comp0 = CompilationUtils.CreateCompilationWithMscorlib({source0, source1, source2, source3}, options:=TestOptions.ReleaseDll) + comp0.AssertTheseDiagnostics() + Assert.Equal({source0, source1, source2, source3}, comp0.SyntaxTrees) + + Dim locations = comp0.GlobalNamespace.Locations + Assert.Equal({"MyTemplateLocation", "SourceLocation", "SourceLocation", "SourceLocation", "SourceLocation", "MetadataLocation"}, locations.Select(Function(l) l.GetType().Name)) + + ' Location order of partial class should match SyntaxTrees order. + locations = comp0.GetMember(Of NamedTypeSymbol)("N.C").Locations + Assert.Equal({source0, source1, source3}, locations.Select(Function(l) l.SourceTree)) + + ' AddSyntaxTrees will add to the end. + Dim source4 = Parse( +"Namespace N + Partial Class C + End Class +End Namespace +Namespace N4 + Class C4 + End Class +End Namespace") + Dim comp1 = comp0.AddSyntaxTrees(source4) + locations = comp1.GetMember(Of NamedTypeSymbol)("N.C").Locations + Assert.Equal({source0, source1, source3, source4}, locations.Select(Function(l) l.SourceTree)) + + ' ReplaceSyntaxTree should preserve location order. + Dim comp2 = comp0.ReplaceSyntaxTree(source1, source4) + locations = comp2.GetMember(Of NamedTypeSymbol)("N.C").Locations + Assert.Equal({source0, source4, source3}, locations.Select(Function(l) l.SourceTree)) + + ' NamespaceNames and TypeNames do not match SyntaxTrees order. + ' This is expected. + Assert.Equal({"", "N3", "N0", "N", "", "N4", "N"}, comp2.Declarations.NamespaceNames.ToArray()) + Assert.Equal({"C3", "C0", "S", "C", "C4", "C"}, comp2.Declarations.TypeNames.ToArray()) + + ' RemoveSyntaxTrees should preserve order of remaining trees. + Dim comp3 = comp2.RemoveSyntaxTrees(source0) + locations = comp3.GetMember(Of NamedTypeSymbol)("N.C").Locations + Assert.Equal({source4, source3}, locations.Select(Function(l) l.SourceTree)) + End Sub + End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Syntax/Parser/DeclarationTests.vb b/src/Compilers/VisualBasic/Test/Syntax/Parser/DeclarationTests.vb index 18e16a7231992..1c739e1c9a493 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/Parser/DeclarationTests.vb +++ b/src/Compilers/VisualBasic/Test/Syntax/Parser/DeclarationTests.vb @@ -106,14 +106,15 @@ end namespace Dim table As DeclarationTable = DeclarationTable.Empty Assert.False(table.AllRootNamespaces().Any) - Dim mr = table.MergedRoot + Dim mr = table.CalculateMergedRoot(Nothing) Assert.NotNull(mr) + Assert.True(mr.Declarations.IsEmpty) + Assert.True(table.TypeNames.IsEmpty()) table = table.AddRootDeclaration(Lazy(decl1)) + mr = table.CalculateMergedRoot(Nothing) - Assert.Same(decl1, table.AllRootNamespaces().Single()) - - mr = table.MergedRoot + Assert.Equal(mr.Declarations, {decl1}) Assert.Equal(DeclarationKind.Namespace, mr.Kind) Assert.Equal("", mr.Name) @@ -142,11 +143,9 @@ end namespace Assert.Equal("D", d.Name) table = table.AddRootDeclaration(Lazy(decl2)) - Assert.Equal(2, table.AllRootNamespaces().Length) - Assert.True(table.AllRootNamespaces().Contains(decl1)) - Assert.True(table.AllRootNamespaces().Contains(decl2)) + mr = table.CalculateMergedRoot(Nothing) - mr = table.MergedRoot + Assert.Equal(mr.Declarations, {decl1, decl2}) Assert.Equal(DeclarationKind.Namespace, mr.Kind) Assert.Equal("", mr.Name) diff --git a/src/Compilers/VisualBasic/VbcCore/project.json b/src/Compilers/VisualBasic/VbcCore/project.json index 7a792911bbc63..ba94bd3e4a94d 100644 --- a/src/Compilers/VisualBasic/VbcCore/project.json +++ b/src/Compilers/VisualBasic/VbcCore/project.json @@ -1,7 +1,7 @@ { "dependencies": { }, "frameworks": { - "dnxcore50": { + "NETCoreApp1.0": { "imports": "portable-net452" } }, diff --git a/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.json b/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.json index 8f892897dea1a..1f15ea8429732 100644 --- a/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.json +++ b/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.json @@ -1,12 +1,12 @@ { "dependencies": { "Microsoft.NETCore.Portable.Compatibility": "1.0.0", - "System.Collections": "4.0.11-rc3-24102-00", - "System.Diagnostics.Debug": "4.0.11-rc3-24102-00", - "System.Runtime": "4.1.0-rc3-24102-00", - "System.Runtime.Extensions": "4.1.0-rc3-24102-00", - "System.Runtime.InteropServices": "4.1.0-rc3-24102-00", - "System.IO.FileSystem": "4.0.1-rc3-24102-00", + "System.Collections": "4.0.11-rc3-24128-00", + "System.Diagnostics.Debug": "4.0.11-rc3-24128-00", + "System.Runtime": "4.1.0-rc3-24128-00", + "System.Runtime.Extensions": "4.1.0-rc3-24128-00", + "System.Runtime.InteropServices": "4.1.0-rc3-24128-00", + "System.IO.FileSystem": "4.0.1-rc3-24128-00", }, "frameworks": { "netstandard1.3": { diff --git a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec index 0b8168acf92e4..47c6abe17bc84 100644 --- a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec +++ b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec @@ -13,19 +13,22 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + en-US diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs index 018de093b6b5f..711df2e93bc09 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs @@ -1719,18 +1719,18 @@ static void Main(string[] args) string src2 = @" class C { - public static readonly int a = F(1); + public static readonly int a = F(1); public C() {} public static int F(int a) { - return a + 1; + return a + 1; } static void Main(string[] args) { - C c = new C(); + C c = new C(); } }"; var edits = GetTopEdits(src1, src2); @@ -7957,6 +7957,52 @@ public static int F(int a) edits.VerifyRudeDiagnostics(active); } + [Fact] + public void MisplacedActiveStatement2() + { + string src1 = @" +class C +{ + static void Main(string[] args) + { + } +}"; + string src2 = @" +class C +{ + static void Main(string[] args) + { + } +}"; + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + edits.VerifyRudeDiagnostics(active); + } + + [Fact] + public void MisplacedTrackingSpan1() + { + string src1 = @" +class C +{ + static void Main(string[] args) + { + } +}"; + string src2 = @" +class C +{ + static void Main(string[] args) + { + } +}"; + var edits = GetTopEdits(src1, src2); + var active = GetActiveStatements(src1, src2); + + edits.VerifyRudeDiagnostics(active); + } + #endregion #region Unmodified Documents diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs index e12d42012085d..0bdd0a3c3ad53 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs @@ -19,7 +19,7 @@ internal static void VerifyUnchangedDocument( CSharpEditAndContinueTestHelpers.Instance.VerifyUnchangedDocument( ActiveStatementsDescription.ClearTags(source), description.OldSpans, - description.TrackingSpans, + description.OldTrackingSpans, description.NewSpans, description.OldRegions, description.NewRegions); diff --git a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.Tagger.cs b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.Tagger.cs index 8770946b01ac9..73590ac662d47 100644 --- a/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.Tagger.cs +++ b/src/EditorFeatures/Core/Implementation/Classification/SemanticClassificationBufferTaggerProvider.Tagger.cs @@ -24,7 +24,7 @@ private class Tagger : ForegroundThreadAffinitizedObject, IAccurateTagger _cachedTags_doNotAccessDirectly; - private ITextSnapshot _cachedSnapshot_doNotAccessDirectly; + private SnapshotSpan? _cachedTaggedSpan_doNotAccessDirectly; private IEditorClassificationService _classificationService; @@ -62,18 +62,18 @@ private TagSpanIntervalTree CachedTags } } - private ITextSnapshot CachedSnapshot + private SnapshotSpan? CachedTaggedSpan { get { this.AssertIsForeground(); - return _cachedSnapshot_doNotAccessDirectly; + return _cachedTaggedSpan_doNotAccessDirectly; } set { this.AssertIsForeground(); - _cachedSnapshot_doNotAccessDirectly = value; + _cachedTaggedSpan_doNotAccessDirectly = value; } } @@ -94,7 +94,7 @@ private void OnEventSourceChanged() // When something changes, clear the cached data we have. this.CachedTags = null; - this.CachedSnapshot = null; + this.CachedTaggedSpan = null; // And notify any concerned parties that we have new tags. this.TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(_subjectBuffer.CurrentSnapshot.GetFullSpan())); @@ -122,9 +122,19 @@ public IEnumerable> GetAllTags(NormalizedSnapshotSp var snapshot = firstSpan.Snapshot; Debug.Assert(snapshot.TextBuffer == _subjectBuffer); - var cachedSnapshot = this.CachedSnapshot; + // We want to classify from the start of the first requested span to the end of the + // last requested span. + var spanToTag = new SnapshotSpan(snapshot, + Span.FromBounds(spans.First().Start, spans.Last().End)); - if (snapshot != cachedSnapshot) + // We don't need to actually classify if what we're being asked for is a subspan + // of the last classification we performed. + var cachedTaggedSpan = this.CachedTaggedSpan; + var canReuseCache = + cachedTaggedSpan?.Snapshot == snapshot && + cachedTaggedSpan.Value.Contains(spanToTag); + + if (!canReuseCache) { // Our cache is not there, or is out of date. We need to compute the up to date // results. @@ -138,11 +148,13 @@ public IEnumerable> GetAllTags(NormalizedSnapshotSp _classificationService = _classificationService ?? document.Project.LanguageServices.GetService(); var context = new TaggerContext(document, snapshot, cancellationToken: cancellationToken); - var spanToTag = new DocumentSnapshotSpan(document, snapshot.GetFullSpan()); - var task = SemanticClassificationUtilities.ProduceTagsAsync(context, spanToTag, _classificationService, _owner._typeMap); + + var task = SemanticClassificationUtilities.ProduceTagsAsync( + context, new DocumentSnapshotSpan(document, spanToTag), + _classificationService, _owner._typeMap); task.Wait(cancellationToken); - CachedSnapshot = snapshot; + CachedTaggedSpan = spanToTag; CachedTags = new TagSpanIntervalTree(snapshot.TextBuffer, SpanTrackingMode.EdgeExclusive, context.tagSpans); } diff --git a/src/EditorFeatures/Test/EditAndContinue/ActiveStatementDescription.cs b/src/EditorFeatures/Test/EditAndContinue/ActiveStatementDescription.cs index f9892f098fb11..511a6f775b1b6 100644 --- a/src/EditorFeatures/Test/EditAndContinue/ActiveStatementDescription.cs +++ b/src/EditorFeatures/Test/EditAndContinue/ActiveStatementDescription.cs @@ -17,7 +17,7 @@ internal class ActiveStatementsDescription public readonly TextSpan[] NewSpans; public readonly ImmutableArray[] OldRegions; public readonly ImmutableArray[] NewRegions; - public readonly TextSpan?[] TrackingSpans; + public readonly TextSpan?[] OldTrackingSpans; private ActiveStatementsDescription() { @@ -25,7 +25,7 @@ private ActiveStatementsDescription() NewSpans = Array.Empty(); OldRegions = Array.Empty>(); NewRegions = Array.Empty>(); - TrackingSpans = null; + OldTrackingSpans = null; } public ActiveStatementsDescription(string oldSource, string newSource) @@ -37,7 +37,9 @@ public ActiveStatementsDescription(string oldSource, string newSource) // Tracking spans are marked in the new source since the editor moves them around as the user // edits the source and we get their positions when analyzing the new source. - TrackingSpans = GetTrackingSpans(newSource, OldSpans.Length); + // The EnC analyzer uses old trackign spans as hints to find matching nodes. + // After an edit the tracking spans are updated to match new active statements. + OldTrackingSpans = GetTrackingSpans(newSource, OldSpans.Length); } internal static readonly ActiveStatementsDescription Empty = new ActiveStatementsDescription(); diff --git a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueTestHelpers.cs b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueTestHelpers.cs index de2da0189b55a..4078d3a00b0d4 100644 --- a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueTestHelpers.cs +++ b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueTestHelpers.cs @@ -80,9 +80,9 @@ internal void VerifyRudeDiagnostics( { var oldActiveStatements = description.OldSpans; - if (description.TrackingSpans != null) + if (description.OldTrackingSpans != null) { - Assert.Equal(oldActiveStatements.Length, description.TrackingSpans.Length); + Assert.Equal(oldActiveStatements.Length, description.OldTrackingSpans.Length); } string newSource = editScript.Match.NewRoot.SyntaxTree.ToString(); @@ -100,9 +100,9 @@ internal void VerifyRudeDiagnostics( DocumentId documentId = DocumentId.CreateNewId(ProjectId.CreateNewId("TestEnCProject"), "TestEnCDocument"); TestActiveStatementTrackingService trackingService; - if (description.TrackingSpans != null) + if (description.OldTrackingSpans != null) { - trackingService = new TestActiveStatementTrackingService(documentId, description.TrackingSpans); + trackingService = new TestActiveStatementTrackingService(documentId, description.OldTrackingSpans); } else { @@ -156,8 +156,9 @@ internal void VerifyRudeDiagnostics( } } - if (description.TrackingSpans != null) + if (description.OldTrackingSpans != null) { + // Verify that the new tracking spans are equal to the new active statements. AssertEx.Equal(trackingService.TrackingSpans, description.NewSpans.Select(s => (TextSpan?)s)); } } diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb index 030872158bf65..1e13756fb43ba 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb @@ -4749,6 +4749,94 @@ End Class edits.VerifyRudeDiagnostics(active) End Sub + + Public Sub MisplacedActiveStatement2() + Dim src1 = " +Class C + + Shared Sub Main() + End Sub +End Class" + Dim src2 = " +Class C + + Shared Sub Main() + End Sub +End Class" + Dim edits = GetTopEdits(src1, src2) + Dim active = GetActiveStatements(src1, src2) + + edits.VerifyRudeDiagnostics(active) + End Sub + + + Public Sub MisplacedTrackingSpan1() + Dim src1 = " +Class C + + Shared Sub Main() + End Sub +End Class" + Dim src2 = " +Class C + + Shared Sub Main() + End Sub +End Class" + Dim edits = GetTopEdits(src1, src2) + Dim active = GetActiveStatements(src1, src2) + + edits.VerifyRudeDiagnostics(active) + End Sub + + + Public Sub MisplacedTrackingSpan2() + Dim src1 = " +Class C + Dim f = 1 +End Class" + Dim src2 = " +Class C + Dim f = 1 +End Class" + Dim edits = GetTopEdits(src1, src2) + Dim active = GetActiveStatements(src1, src2) + + edits.VerifyRudeDiagnostics(active) + End Sub + + + Public Sub MisplacedTrackingSpan3() + Dim src1 = " +Class C + Dim f, g As New C() +End Class" + Dim src2 = " +Class C + Dim f, g As New C() +End Class" + Dim edits = GetTopEdits(src1, src2) + Dim active = GetActiveStatements(src1, src2) + + edits.VerifyRudeDiagnostics(active) + End Sub + + + Public Sub MisplacedTrackingSpan4() + Dim src1 = " +Class C + Property f As New C() +End Class" + Dim src2 = " +Class C + Property f As New C() +End Class" + Dim edits = GetTopEdits(src1, src2) + Dim active = GetActiveStatements(src1, src2) + + edits.VerifyRudeDiagnostics(active) + End Sub + Public Sub Lambdas_LeafEdits_GeneralStatement() Dim src1 = " diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb index bd9da5d97c62b..7fc4de088b58a 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb @@ -20,7 +20,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests VisualBasicEditAndContinueTestHelpers.Instance.VerifyUnchangedDocument( ActiveStatementsDescription.ClearTags(source), description.OldSpans, - description.TrackingSpans, + description.OldTrackingSpans, description.NewSpans, description.OldRegions, description.NewRegions) diff --git a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs index 12b1b898227e0..af0d0daa2c556 100644 --- a/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs +++ b/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs @@ -270,13 +270,12 @@ protected override SyntaxNode FindStatementAndPartner(SyntaxNode declarationBody declarationBody = constructor.Initializer; partnerDeclarationBodyOpt = partnerConstructor?.Initializer; } - else - { - Debug.Assert(!(declarationBody is BlockSyntax)); + } - // let's find a labeled node that encompasses the body: - position = declarationBody.SpanStart; - } + if (!declarationBody.FullSpan.Contains(position)) + { + // invalid position, let's find a labeled node that encompasses the body: + position = declarationBody.SpanStart; } SyntaxNode node; @@ -284,7 +283,7 @@ protected override SyntaxNode FindStatementAndPartner(SyntaxNode declarationBody { SyntaxUtilities.FindLeafNodeAndPartner(declarationBody, position, partnerDeclarationBodyOpt, out node, out partnerOpt); } - else + else { node = declarationBody.FindToken(position).Parent; partnerOpt = null; @@ -453,7 +452,7 @@ protected override SyntaxNode FindEnclosingLambdaBody(SyntaxNode containerOpt, S { SyntaxNode root = GetEncompassingAncestor(containerOpt); - while (node != root) + while (node != root && node != null) { SyntaxNode body; if (LambdaUtilities.IsLambdaBodyStatementOrExpression(node, out body)) diff --git a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs index 245e6d7322627..7854e089bdff7 100644 --- a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs +++ b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs @@ -123,6 +123,7 @@ protected SyntaxNode GetEncompassingAncestor(SyntaxNode bodyOrMatchRootOpt) /// /// The declaration body node may not contain the . /// This happens when an active statement associated with the member is outside of its body (e.g. C# constructor). + /// If the position doesn't correspond to any statement uses the start of the . /// protected abstract SyntaxNode FindStatementAndPartner(SyntaxNode declarationBody, int position, SyntaxNode partnerDeclarationBodyOpt, out SyntaxNode partnerOpt, out int statementPart); @@ -506,12 +507,26 @@ public async Task AnalyzeDocumentAsync( lineEdits.AsImmutable(), hasSemanticErrors: false); } - catch (Exception e) when (FatalError.ReportUnlessCanceled(e)) + catch (Exception e) when (ReportFatalErrorAnalyzeDocumentAsync(baseActiveStatements, e)) { throw ExceptionUtilities.Unreachable; } } + // Active statements spans are usually unavailable in crash dumps due to a bug in the debugger (DevDiv #150901), + // so we stash them here in plain array (can't use immutable, see the bug) just before we report NFW. + private static ActiveStatementSpan[] s_fatalErrorBaseActiveStatements; + + private static bool ReportFatalErrorAnalyzeDocumentAsync(ImmutableArray baseActiveStatements, Exception e) + { + if (!(e is OperationCanceledException)) + { + s_fatalErrorBaseActiveStatements = baseActiveStatements.ToArray(); + } + + return FatalError.ReportUnlessCanceled(e); + } + internal Dictionary BuildEditMap(EditScript editScript) { var map = new Dictionary(editScript.Edits.Length); @@ -598,7 +613,7 @@ private void UpdateUneditedSpans( { if (!editedActiveStatements[i]) { - Debug.Assert(newExceptionRegions[i].IsDefault); + Contract.ThrowIfFalse(newExceptionRegions[i].IsDefault); TextSpan trackedSpan = default(TextSpan); bool isTracked = trackingService != null && @@ -624,7 +639,7 @@ private void UpdateUneditedSpans( SyntaxNode newMember; bool hasPartner = topMatch.TryGetNewNode(oldMember, out newMember); - Debug.Assert(hasPartner); + Contract.ThrowIfFalse(hasPartner); SyntaxNode oldBody = TryGetDeclarationBody(oldMember, isMember: true); SyntaxNode newBody = TryGetDeclarationBody(newMember, isMember: true); @@ -645,11 +660,18 @@ private void UpdateUneditedSpans( if (isTracked && trackedSpan.Length != 0 && newMember.Span.Contains(trackedSpan)) { int trackedStatementPart; + var trackedStatement = FindStatement(newBody, trackedSpan.Start, out trackedStatementPart); + Contract.ThrowIfNull(trackedStatement); + + // Adjust for active statements that cover more than the old member span. + // For example, C# variable declarators that represent field initializers: + // [|public int <>;|] + int adjustedOldStatementStart = oldMember.FullSpan.Contains(oldStatementSpan.Start) ? oldStatementSpan.Start : oldMember.SpanStart; - // In rare cases the tracking span might have been moved outside of lambda. + // The tracking span might have been moved outside of lambda. // It is not an error to move the statement - we just ignore it. - var oldEnclosingLambdaBody = FindEnclosingLambdaBody(oldBody, oldMember.FindToken(oldStatementSpan.Start).Parent); + var oldEnclosingLambdaBody = FindEnclosingLambdaBody(oldBody, oldMember.FindToken(adjustedOldStatementStart).Parent); var newEnclosingLambdaBody = FindEnclosingLambdaBody(newBody, trackedStatement); if (oldEnclosingLambdaBody == newEnclosingLambdaBody) { @@ -660,8 +682,9 @@ private void UpdateUneditedSpans( if (newStatement == null) { - Debug.Assert(statementPart == -1); + Contract.ThrowIfFalse(statementPart == -1); FindStatementAndPartner(oldBody, oldStatementSpan.Start, newBody, out newStatement, out statementPart); + Contract.ThrowIfNull(newStatement); } if (diagnostics.Count == 0) @@ -940,7 +963,10 @@ private void AnalyzeUpdatedActiveMethodBodies( int statementPart; var oldStatementStart = oldText.Lines.GetTextSpan(oldActiveStatements[ordinal].Span).Start; + var oldStatementSyntax = FindStatement(oldBody, oldStatementStart, out statementPart); + Contract.ThrowIfNull(oldStatementSyntax); + var oldEnclosingLambdaBody = FindEnclosingLambdaBody(oldBody, oldStatementSyntax); if (oldEnclosingLambdaBody != null) @@ -975,6 +1001,8 @@ private void AnalyzeUpdatedActiveMethodBodies( { int part; var newStatementSyntax = FindStatement(newBody, trackedSpan.Start, out part); + Contract.ThrowIfNull(newStatementSyntax); + var newEnclosingLambdaBody = FindEnclosingLambdaBody(newBody, newStatementSyntax); // The tracking span might have been moved outside of the lambda span. diff --git a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb index 1c2b35dc7257e..173782da7370c 100644 --- a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb +++ b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb @@ -418,18 +418,22 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue End If End If - Debug.Assert(declarationBody.Parent.IsKind(SyntaxKind.EqualsValue)) - Debug.Assert(declarationBody.Parent.Parent.IsKind(SyntaxKind.VariableDeclarator) AndAlso - declarationBody.Parent.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration)) + If declarationBody.Parent.IsKind(SyntaxKind.EqualsValue) Then + Debug.Assert(declarationBody.Parent.Parent.IsKind(SyntaxKind.VariableDeclarator) AndAlso + declarationBody.Parent.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration)) - If partnerDeclarationBodyOpt IsNot Nothing Then - partnerOpt = partnerDeclarationBodyOpt.Parent.Parent - End If + If partnerDeclarationBodyOpt IsNot Nothing Then + partnerOpt = partnerDeclarationBodyOpt.Parent.Parent + End If - Return declarationBody.Parent.Parent + Return declarationBody.Parent.Parent + End If End If - Debug.Assert(declarationBody.FullSpan.Contains(position)) + If Not declarationBody.FullSpan.Contains(position) Then + ' invalid position, let's find a labeled node that encompasses the body: + position = declarationBody.SpanStart + End If Dim node As SyntaxNode = Nothing If partnerDeclarationBodyOpt IsNot Nothing Then @@ -544,7 +548,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Protected Overrides Function FindEnclosingLambdaBody(containerOpt As SyntaxNode, node As SyntaxNode) As SyntaxNode Dim root As SyntaxNode = GetEncompassingAncestor(containerOpt) - While node IsNot root + While node IsNot root And node IsNot Nothing Dim body As SyntaxNode = Nothing If LambdaUtilities.IsLambdaBodyStatementOrExpression(node, body) Then Return body diff --git a/src/Interactive/CsiCore/project.json b/src/Interactive/CsiCore/project.json index 3e83886a174ce..c6195470b2c32 100644 --- a/src/Interactive/CsiCore/project.json +++ b/src/Interactive/CsiCore/project.json @@ -1,10 +1,10 @@ { "dependencies": { - "System.AppContext": "4.1.0-rc3-24102-00" + "System.AppContext": "4.1.0-rc3-24128-00" }, "frameworks": { - "dnxcore50": { - "imports": "portable-net452" + "NETCoreApp1.0": { + "imports": ["portable-net452", "dotnet"] } }, "runtimes": { diff --git a/src/Interactive/VbiCore/project.json b/src/Interactive/VbiCore/project.json index de82f48168f86..6848e33fa5a9e 100644 --- a/src/Interactive/VbiCore/project.json +++ b/src/Interactive/VbiCore/project.json @@ -1,10 +1,10 @@ { "dependencies": { - "System.AppContext": "4.1.0-rc3-24102-00" + "System.AppContext": "4.1.0-rc3-24128-00" }, "frameworks": { - "dnxcore50": { - "imports": "portable-net452" + "NETCoreApp1.0": { + "imports": ["portable-net452", "dotnet"] } }, "runtimes": { diff --git a/src/NuGet/Microsoft.CodeAnalysis.BuildTask.Portable.nuspec b/src/NuGet/Microsoft.CodeAnalysis.BuildTask.Portable.nuspec deleted file mode 100644 index 1591eadceda19..0000000000000 --- a/src/NuGet/Microsoft.CodeAnalysis.BuildTask.Portable.nuspec +++ /dev/null @@ -1,41 +0,0 @@ - - - - Microsoft.CodeAnalysis.BuildTask.Portable - - CoreCLR-compatible versions of the C# and VB compilers. - - Supported Platforms: - - .NET Core (dnxcore50) - - en-US - true - $version$ - $authors$ - $licenseUrl$ - $projectUrl$ - $tags$ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/NuGet/Microsoft.CodeAnalysis.Common.nuspec b/src/NuGet/Microsoft.CodeAnalysis.Common.nuspec index 8fe025835d97e..6aecbedddc032 100644 --- a/src/NuGet/Microsoft.CodeAnalysis.Common.nuspec +++ b/src/NuGet/Microsoft.CodeAnalysis.Common.nuspec @@ -21,44 +21,44 @@ Supported Platforms: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NuGet/Microsoft.CodeAnalysis.Scripting.Common.nuspec b/src/NuGet/Microsoft.CodeAnalysis.Scripting.Common.nuspec index 78f23bc94b02d..987d2f7c16c0c 100644 --- a/src/NuGet/Microsoft.CodeAnalysis.Scripting.Common.nuspec +++ b/src/NuGet/Microsoft.CodeAnalysis.Scripting.Common.nuspec @@ -18,25 +18,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/NuGet/Microsoft.Net.CSharp.Interactive.netcore.nuspec b/src/NuGet/Microsoft.Net.CSharp.Interactive.netcore.nuspec index 28e9e1e42fda1..9ed85fb6d1029 100644 --- a/src/NuGet/Microsoft.Net.CSharp.Interactive.netcore.nuspec +++ b/src/NuGet/Microsoft.Net.CSharp.Interactive.netcore.nuspec @@ -6,7 +6,7 @@ CoreCLR-compatible version of csi.exe. Supported Platforms: - - .NET Core (dnxcore50) + - .NET Core (NETCoreApp1.0) en-US true @@ -16,10 +16,10 @@ $projectUrl$ $tags$ - + - + diff --git a/src/NuGet/Microsoft.Net.Compilers.netcore.nuspec b/src/NuGet/Microsoft.Net.Compilers.netcore.nuspec index aa71fa1c5d916..02250bd6ea96f 100644 --- a/src/NuGet/Microsoft.Net.Compilers.netcore.nuspec +++ b/src/NuGet/Microsoft.Net.Compilers.netcore.nuspec @@ -6,7 +6,7 @@ CoreCLR-compatible versions of the C# and VB compilers. Supported Platforms: - - .NET Core (dnxcore50) + - .NET Core (NETCoreApp1.0) en-US true @@ -16,52 +16,52 @@ $projectUrl$ $tags$ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/Scripting/CSharpTest.Desktop/project.json b/src/Scripting/CSharpTest.Desktop/project.json index 26963f069987d..5ac00ae2aa20b 100644 --- a/src/Scripting/CSharpTest.Desktop/project.json +++ b/src/Scripting/CSharpTest.Desktop/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "System.Diagnostics.Process": "4.1.0-rc3-24102-00" + "System.Diagnostics.Process": "4.1.0-rc3-24128-00" }, "frameworks": { "net46": {} diff --git a/src/Scripting/CSharpTest/project.json b/src/Scripting/CSharpTest/project.json index d4997e0400719..cb340c3d221d6 100644 --- a/src/Scripting/CSharpTest/project.json +++ b/src/Scripting/CSharpTest/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "System.AppContext": "4.0.0" + "System.AppContext": "4.1.0-rc3-24128-00" }, "frameworks": { "netstandard1.3": { diff --git a/src/Scripting/Core/Scripting.csproj b/src/Scripting/Core/Scripting.csproj index 279bbd5f249cb..67d3633dc1124 100644 --- a/src/Scripting/Core/Scripting.csproj +++ b/src/Scripting/Core/Scripting.csproj @@ -39,7 +39,7 @@ - + False diff --git a/src/Scripting/Core/project.json b/src/Scripting/Core/project.json index 1969e55f38a85..1f087e87cf701 100644 --- a/src/Scripting/Core/project.json +++ b/src/Scripting/Core/project.json @@ -1,23 +1,23 @@ { "dependencies": { "Microsoft.NETCore.Portable.Compatibility": "1.0.0", - "System.Collections": "4.0.11-rc3-24102-00", - "System.Diagnostics.Debug": "4.0.11-rc3-24102-00", - "System.Diagnostics.StackTrace": "4.0.1-rc3-24102-00", - "System.Diagnostics.Tools": "4.0.1-rc3-24102-00", - "System.Globalization": "4.0.11-rc3-24102-00", - "System.IO": "4.1.0-rc3-24102-00", - "System.IO.FileSystem": "4.0.1-rc3-24102-00", - "System.Linq": "4.1.0-rc3-24102-00", - "System.Linq.Expressions": "4.1.0-rc3-24102-00", - "System.Reflection": "4.1.0-rc3-24102-00", - "System.Reflection.Extensions": "4.0.1-rc3-24102-00", - "System.Resources.ResourceManager": "4.0.1-rc3-24102-00", - "System.Runtime": "4.1.0-rc3-24102-00", - "System.Runtime.Extensions": "4.1.0-rc3-24102-00", - "System.Runtime.InteropServices": "4.1.0-rc3-24102-00", - "System.Threading": "4.0.11-rc3-24102-00", - "System.Threading.Tasks": "4.0.11-rc3-24102-00" + "System.Collections": "4.0.11-rc3-24128-00", + "System.Diagnostics.Debug": "4.0.11-rc3-24128-00", + "System.Diagnostics.StackTrace": "4.0.1-rc3-24128-00", + "System.Diagnostics.Tools": "4.0.1-rc3-24128-00", + "System.Globalization": "4.0.11-rc3-24128-00", + "System.IO": "4.1.0-rc3-24128-00", + "System.IO.FileSystem": "4.0.1-rc3-24128-00", + "System.Linq": "4.1.0-rc3-24128-00", + "System.Linq.Expressions": "4.1.0-rc3-24128-00", + "System.Reflection": "4.1.0-rc3-24128-00", + "System.Reflection.Extensions": "4.0.1-rc3-24128-00", + "System.Resources.ResourceManager": "4.0.1-rc3-24128-00", + "System.Runtime": "4.1.0-rc3-24128-00", + "System.Runtime.Extensions": "4.1.0-rc3-24128-00", + "System.Runtime.InteropServices": "4.1.0-rc3-24128-00", + "System.Threading": "4.0.11-rc3-24128-00", + "System.Threading.Tasks": "4.0.11-rc3-24128-00" }, "frameworks": { "netstandard1.3": { diff --git a/src/Scripting/VisualBasicTest/project.json b/src/Scripting/VisualBasicTest/project.json index 6955c0a51fb5f..64fe08212c4c1 100644 --- a/src/Scripting/VisualBasicTest/project.json +++ b/src/Scripting/VisualBasicTest/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "System.AppContext": "4.0.0" + "System.AppContext": "4.1.0-rc3-24128-00" }, "frameworks": { "netstandard1.3": { diff --git a/src/Test/DeployCoreClrTestRuntime/project.json b/src/Test/DeployCoreClrTestRuntime/project.json index 65c2c65ab04cf..1a716809146aa 100644 --- a/src/Test/DeployCoreClrTestRuntime/project.json +++ b/src/Test/DeployCoreClrTestRuntime/project.json @@ -3,8 +3,8 @@ "xunit.console.netcore": "1.0.2-prerelease-00104" }, "frameworks": { - "dnxcore50": { - "imports": "portable-net452" + "NETCoreApp1.0": { + "imports": [ "portable-net452", "dotnet" ] } }, "runtimes": { diff --git a/src/Test/Utilities/Portable/project.json b/src/Test/Utilities/Portable/project.json index 41d6e8e4c9cc7..9f6e562218297 100644 --- a/src/Test/Utilities/Portable/project.json +++ b/src/Test/Utilities/Portable/project.json @@ -1,17 +1,17 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.0", - "Microsoft.NETCore.Platforms": "1.0.1-rc3-24102-00", "Microsoft.CSharp": "4.0.0", - "System.Collections.Concurrent": "4.0.12-rc3-24102-00", - "System.Console": "4.0.0-rc3-24102-00", - "System.Diagnostics.Debug": "4.0.11-rc3-24102-00", - "System.Diagnostics.Tools": "4.0.1-rc3-24102-00", - "System.IO.FileSystem": "4.0.1-rc3-24102-00", - "System.Reflection.TypeExtensions": "4.1.0-rc3-24102-00", - "System.Threading.Thread": "4.0.0-rc3-24102-00", - "System.Xml.XDocument": "4.0.11-rc3-24102-00", - "System.Xml.XmlDocument": "4.0.1-rc3-24102-00", + "Microsoft.NETCore.Platforms": "1.0.1-rc3-24128-00", + "Microsoft.NETCore.Portable.Compatibility": "1.0.0", + "System.Collections.Concurrent": "4.0.12-rc3-24128-00", + "System.Console": "4.0.0-rc3-24128-00", + "System.Diagnostics.Debug": "4.0.11-rc3-24128-00", + "System.Diagnostics.Tools": "4.0.1-rc3-24128-00", + "System.IO.FileSystem": "4.0.1-rc3-24128-00", + "System.Reflection.TypeExtensions": "4.1.0-rc3-24128-00", + "System.Threading.Thread": "4.0.0-rc3-24128-00", + "System.Xml.XDocument": "4.0.11-rc3-24128-00", + "System.Xml.XmlDocument": "4.0.1-rc3-24128-00" }, "frameworks": { "netstandard1.3": { diff --git a/src/Tools/CommonCoreClrRuntime/CommonCoreClrRuntime.csproj b/src/Tools/CommonCoreClrRuntime/CommonCoreClrRuntime.csproj index 57f8bef6875d8..2463048a1d357 100644 --- a/src/Tools/CommonCoreClrRuntime/CommonCoreClrRuntime.csproj +++ b/src/Tools/CommonCoreClrRuntime/CommonCoreClrRuntime.csproj @@ -30,8 +30,8 @@ - + - DNXCore,Version=v5.0 + .NETCoreApp,Version=v1.0 \ No newline at end of file diff --git a/src/Tools/CommonCoreClrRuntime/project.json b/src/Tools/CommonCoreClrRuntime/project.json index d8014da8b455f..0bbcec0ebdf8e 100644 --- a/src/Tools/CommonCoreClrRuntime/project.json +++ b/src/Tools/CommonCoreClrRuntime/project.json @@ -1,11 +1,11 @@ { "dependencies": { - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2-rc2-23931", - "Microsoft.NETCore.TestHost": "1.0.0-rc2-23931", - "System.Runtime": "4.0.20" + "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2-rc3-24128-00", + "Microsoft.NETCore.TestHost": "1.0.0-rc3-24128-00", + "System.Runtime": "4.1.0-rc3-24128-00" }, "frameworks": { - "dnxcore50": { + "NETCoreApp1.0": { "imports": "portable-net452" } } diff --git a/src/Tools/CommonNetCoreReferences/CommonNetCoreReferences.csproj b/src/Tools/CommonNetCoreReferences/CommonNetCoreReferences.csproj index 73bcdc0fe2175..e13837aeb060c 100644 --- a/src/Tools/CommonNetCoreReferences/CommonNetCoreReferences.csproj +++ b/src/Tools/CommonNetCoreReferences/CommonNetCoreReferences.csproj @@ -30,8 +30,8 @@ - + - DNXCore,Version=v5.0 + .NETCoreApp,Version=v1.0 \ No newline at end of file diff --git a/src/Tools/CommonNetCoreReferences/project.json b/src/Tools/CommonNetCoreReferences/project.json index 221a874a62cad..ed114c0cc5715 100644 --- a/src/Tools/CommonNetCoreReferences/project.json +++ b/src/Tools/CommonNetCoreReferences/project.json @@ -1,55 +1,55 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24102-00", - "Microsoft.NETCore.Platforms": "1.0.1-rc3-24102-00", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2-rc3-24102-00", - "Microsoft.NETCore.TestHost": "1.0.0-rc3-24102-00", - "System.AppContext": "4.1.0-rc3-24102-00", - "System.Collections": "4.0.11-rc3-24102-00", - "System.Collections.Concurrent": "4.0.12-rc3-24102-00", - "System.Collections.Immutable": "1.2.0-rc3-24102-00", - "System.Console": "4.0.0-rc3-24102-00", - "System.Diagnostics.Debug": "4.0.11-rc3-24102-00", - "System.Diagnostics.FileVersionInfo": "4.0.0-rc3-24102-00", - "System.Diagnostics.Process": "4.1.0-rc3-24102-00", - "System.Diagnostics.StackTrace": "4.0.1-rc3-24102-00", - "System.Diagnostics.Tools": "4.0.1-rc3-24102-00", - "System.Dynamic.Runtime": "4.0.11-rc3-24102-00", - "System.Globalization": "4.0.11-rc3-24102-00", - "System.IO.FileSystem": "4.0.1-rc3-24102-00", - "System.IO.FileSystem.Primitives": "4.0.1-rc3-24102-00", - "System.IO.FileSystem.Watcher": "4.0.0-rc3-24102-00", - "System.IO.Pipes": "4.0.0-rc3-24102-00", - "System.Linq": "4.1.0-rc3-24102-00", - "System.Linq.Expressions": "4.1.0-rc3-24102-00", - "System.Net.NameResolution": "4.0.0-rc3-24102-00", - "System.Net.Sockets": "4.1.0-rc3-24102-00", - "System.Reflection": "4.1.0-rc3-24102-00", - "System.Reflection.Primitives": "4.0.1-rc3-24102-00", - "System.Resources.ResourceManager": "4.0.1-rc3-24102-00", - "System.Runtime": "4.1.0-rc3-24102-00", - "System.Runtime.Extensions": "4.1.0-rc3-24102-00", - "System.Runtime.Handles": "4.0.1-rc3-24102-00", - "System.Runtime.InteropServices": "4.1.0-rc3-24102-00", - "System.Runtime.Loader": "4.0.0-rc3-24102-00", - "System.Runtime.Numerics": "4.0.1-rc3-24102-00", - "System.Security.Cryptography.Algorithms": "4.1.0-rc3-24102-00", - "System.Security.Cryptography.Encoding": "4.0.0-rc3-24102-00", - "System.Security.Cryptography.X509Certificates": "4.1.0-rc3-24102-00", - "System.Text.Encoding": "4.0.11-rc3-24102-00", - "System.Text.Encoding.CodePages": "4.0.1-rc3-24102-00", - "System.Text.Encoding.Extensions": "4.0.11-rc3-24102-00", - "System.Threading": "4.0.11-rc3-24102-00", - "System.Threading.Tasks": "4.0.11-rc3-24102-00", - "System.Threading.Tasks.Parallel": "4.0.1-rc3-24102-00", - "System.Threading.Thread": "4.0.0-rc3-24102-00", - "System.Xml.ReaderWriter": "4.0.11-rc3-24102-00", - "System.Xml.XDocument": "4.0.11-rc3-24102-00", - "System.Xml.XmlDocument": "4.0.1-rc3-24102-00", - "System.Xml.XPath.XDocument": "4.0.1-rc3-24102-00" + "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24128-00", + "Microsoft.NETCore.Platforms": "1.0.1-rc3-24128-00", + "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2-rc3-24128-00", + "Microsoft.NETCore.TestHost": "1.0.0-rc3-24128-00", + "System.AppContext": "4.1.0-rc3-24128-00", + "System.Collections": "4.0.11-rc3-24128-00", + "System.Collections.Concurrent": "4.0.12-rc3-24128-00", + "System.Collections.Immutable": "1.2.0-rc3-24128-00", + "System.Console": "4.0.0-rc3-24128-00", + "System.Diagnostics.Debug": "4.0.11-rc3-24128-00", + "System.Diagnostics.FileVersionInfo": "4.0.0-rc3-24128-00", + "System.Diagnostics.Process": "4.1.0-rc3-24128-00", + "System.Diagnostics.StackTrace": "4.0.1-rc3-24128-00", + "System.Diagnostics.Tools": "4.0.1-rc3-24128-00", + "System.Dynamic.Runtime": "4.0.11-rc3-24128-00", + "System.Globalization": "4.0.11-rc3-24128-00", + "System.IO.FileSystem": "4.0.1-rc3-24128-00", + "System.IO.FileSystem.Primitives": "4.0.1-rc3-24128-00", + "System.IO.FileSystem.Watcher": "4.0.0-rc3-24128-00", + "System.IO.Pipes": "4.0.0-rc3-24128-00", + "System.Linq": "4.1.0-rc3-24128-00", + "System.Linq.Expressions": "4.1.0-rc3-24128-00", + "System.Net.NameResolution": "4.0.0-rc3-24128-00", + "System.Net.Sockets": "4.1.0-rc3-24128-00", + "System.Reflection": "4.1.0-rc3-24128-00", + "System.Reflection.Primitives": "4.0.1-rc3-24128-00", + "System.Resources.ResourceManager": "4.0.1-rc3-24128-00", + "System.Runtime": "4.1.0-rc3-24128-00", + "System.Runtime.Extensions": "4.1.0-rc3-24128-00", + "System.Runtime.Handles": "4.0.1-rc3-24128-00", + "System.Runtime.InteropServices": "4.1.0-rc3-24128-00", + "System.Runtime.Loader": "4.0.0-rc3-24128-00", + "System.Runtime.Numerics": "4.0.1-rc3-24128-00", + "System.Security.Cryptography.Algorithms": "4.2.0-rc3-24128-00", + "System.Security.Cryptography.Encoding": "4.0.0-rc3-24128-00", + "System.Security.Cryptography.X509Certificates": "4.1.0-rc3-24128-00", + "System.Text.Encoding": "4.0.11-rc3-24128-00", + "System.Text.Encoding.CodePages": "4.0.1-rc3-24128-00", + "System.Text.Encoding.Extensions": "4.0.11-rc3-24128-00", + "System.Threading": "4.0.11-rc3-24128-00", + "System.Threading.Tasks": "4.0.11-rc3-24128-00", + "System.Threading.Tasks.Parallel": "4.0.1-rc3-24128-00", + "System.Threading.Thread": "4.0.0-rc3-24128-00", + "System.Xml.ReaderWriter": "4.0.11-rc3-24128-00", + "System.Xml.XDocument": "4.0.11-rc3-24128-00", + "System.Xml.XmlDocument": "4.0.1-rc3-24128-00", + "System.Xml.XPath.XDocument": "4.0.1-rc3-24128-00" }, "frameworks": { - "dnxcore50": { + "netcoreapp1.0": { "imports": "portable-net452" } } diff --git a/src/Tools/Source/CompilerGeneratorTools/DeployCompilerGeneratorToolsRuntime/project.json b/src/Tools/Source/CompilerGeneratorTools/DeployCompilerGeneratorToolsRuntime/project.json index 2303e15f92e66..802462bb1bcf4 100644 --- a/src/Tools/Source/CompilerGeneratorTools/DeployCompilerGeneratorToolsRuntime/project.json +++ b/src/Tools/Source/CompilerGeneratorTools/DeployCompilerGeneratorToolsRuntime/project.json @@ -1,12 +1,12 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24102-00", - "Microsoft.NETCore.Platforms": "1.0.1-rc3-24102-00", - "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2-rc3-24102-00", - "Microsoft.NETCore.TestHost": "1.0.0-rc3-24102-00" + "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24128-00", + "Microsoft.NETCore.Platforms": "1.0.1-rc3-24128-00", + "Microsoft.NETCore.Runtime.CoreCLR": "1.0.2-rc3-24128-00", + "Microsoft.NETCore.TestHost": "1.0.0-rc3-24128-00" }, "frameworks": { - "dnxcore50": { + "NETCoreApp1.0": { "imports": "portable-net452" } }, diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/project.json b/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/project.json index a58ad40e7b87d..80e6c85f0496e 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/project.json +++ b/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/project.json @@ -1,12 +1,12 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24102-00", - "NETStandard.Library": "1.5.0-rc3-24102-00", - "System.Xml.XmlDocument": "4.0.1-rc3-24102-00", - "System.Xml.XmlSerializer": "4.0.11-rc3-24102-00" + "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24128-00", + "NETStandard.Library": "1.6.0-rc3-24128-00", + "System.Xml.XmlDocument": "4.0.1-rc3-24128-00", + "System.Xml.XmlSerializer": "4.0.11-rc3-24128-00" }, "frameworks": { - "dnxcore50": { } + "NETCoreApp1.0": { } }, "runtimes": { "win7-x64": {}, diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/project.json b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/project.json index 0af5266666081..4efd92eaa7849 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/project.json +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpErrorFactsGenerator/project.json @@ -1,10 +1,10 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24102-00", - "NETStandard.Library": "1.5.0-rc3-24102-00" + "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24128-00", + "NETStandard.Library": "1.6.0-rc3-24128-00", }, "frameworks": { - "dnxcore50": { } + "NETCoreApp1.0": { } }, "runtimes": { "win7-x64": {}, diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/project.json b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/project.json index b04723b7a08f7..78401cedd5c53 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/project.json +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/project.json @@ -1,12 +1,12 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24102-00", - "NETStandard.Library": "1.5.0-rc3-24102-00", - "System.Xml.XmlDocument": "4.0.1-rc3-24102-00", - "System.Xml.XmlSerializer": "4.0.11-rc3-24102-00" + "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24128-00", + "NETStandard.Library": "1.6.0-rc3-24128-00", + "System.Xml.XmlDocument": "4.0.1-rc3-24128-00", + "System.Xml.XmlSerializer": "4.0.11-rc3-24128-00" }, "frameworks": { - "dnxcore50": { } + "NETCoreApp1.0": { } }, "runtimes": { "win7-x64": {}, diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicErrorFactsGenerator/project.json b/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicErrorFactsGenerator/project.json index f36eee709b0eb..dd660270bb73d 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicErrorFactsGenerator/project.json +++ b/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicErrorFactsGenerator/project.json @@ -1,10 +1,10 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24102-00", - "NETStandard.Library": "1.5.0-rc3-24102-00" + "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24128-00", + "NETStandard.Library": "1.6.0-rc3-24128-00" }, "frameworks": { - "dnxcore50": { } + "NETCoreApp1.0": { } }, "runtimes": { "win7-x64": {}, diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/project.json b/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/project.json index b6821c42edff8..d7e4c501789ab 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/project.json +++ b/src/Tools/Source/CompilerGeneratorTools/Source/VisualBasicSyntaxGenerator/project.json @@ -1,12 +1,12 @@ { "dependencies": { - "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24102-00", - "NETStandard.Library": "1.5.0-rc3-24102-00", - "System.Console": "4.0.0-rc3-24102-00", - "System.Security.Cryptography.Algorithms": "4.1.0-rc3-24102-00" + "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc3-24128-00", + "NETStandard.Library": "1.6.0-rc3-24128-00", + "System.Console": "4.0.0-rc3-24128-00", + "System.Security.Cryptography.Algorithms": "4.2.0-rc3-24128-00" }, "frameworks": { - "dnxcore50": { } + "NETCoreApp1.0": { } }, "runtimes": { "win7-x64": {},