Merge branch 'master' into johluo/migrating-extensions

This commit is contained in:
John Luo 2020-02-20 14:23:15 -08:00 committed by GitHub
commit 825ef65da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 351 additions and 72 deletions

View File

@ -38,7 +38,12 @@ variables:
value: '' value: ''
- name: _SignType - name: _SignType
value: '' value: ''
- name: _UseHelixOpenQueues
value: 'true'
- ${{ if eq(variables['System.TeamProject'], 'internal') }}: - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNet-HelixApi-Access
- name: _UseHelixOpenQueues
value: 'false'
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: - ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
# DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1 # DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
@ -582,6 +587,7 @@ stages:
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl - script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
displayName: Run build.cmd helix target displayName: Run build.cmd helix target
env: env:
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
artifacts: artifacts:
- name: Helix_logs - name: Helix_logs
@ -591,6 +597,7 @@ stages:
- template: jobs/default-build.yml - template: jobs/default-build.yml
parameters: parameters:
condition: ne(variables['Build.Reason'], 'PullRequest')
jobName: Helix_x64_daily jobName: Helix_x64_daily
jobDisplayName: 'Tests: Helix x64 Daily' jobDisplayName: 'Tests: Helix x64 Daily'
agentOs: Windows agentOs: Windows
@ -601,6 +608,7 @@ stages:
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl - script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
displayName: Run build.cmd helix target displayName: Run build.cmd helix target
env: env:
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
artifacts: artifacts:
- name: Helix_logs - name: Helix_logs
@ -622,6 +630,7 @@ stages:
- script: ./build.sh -ci --arch arm64 -test --no-build-nodejs -projects $(Build.SourcesDirectory)/eng/helix/helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl - script: ./build.sh -ci --arch arm64 -test --no-build-nodejs -projects $(Build.SourcesDirectory)/eng/helix/helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
displayName: Run build.sh helix arm64 target displayName: Run build.sh helix arm64 target
env: env:
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
installNodeJs: false installNodeJs: false
artifacts: artifacts:

View File

@ -11,6 +11,14 @@ pr:
include: include:
- '*' - '*'
variables:
- ${{ if ne(variables['System.TeamProject'], 'internal') }}:
- name: _UseHelixOpenQueues
value: 'true'
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- name: _UseHelixOpenQueues
value: 'false'
jobs: jobs:
- template: jobs/default-build.yml - template: jobs/default-build.yml
parameters: parameters:

View File

@ -233,7 +233,7 @@ jobs:
condition: always() condition: always()
inputs: inputs:
testRunner: junit testRunner: junit
testResultsFiles: '**/TEST-com.microsoft.signalr*.xml' testResultsFiles: '**/TEST-junit-jupiter.xml'
buildConfiguration: $(BuildConfiguration) buildConfiguration: $(BuildConfiguration)
buildPlatform: $(AgentOsName) buildPlatform: $(AgentOsName)
mergeTestResults: true mergeTestResults: true

5
.gitattributes vendored
View File

@ -8,6 +8,11 @@
############################################################################### ###############################################################################
*.sh eol=lf *.sh eol=lf
###############################################################################
# Make gradlew always have LF as line endings
###############################################################################
gradlew eol=lf
############################################################################### ###############################################################################
# Set default behavior for command prompt diff. # Set default behavior for command prompt diff.
# #

View File

@ -187,5 +187,6 @@
<Import Project="eng\targets\CSharp.Common.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" /> <Import Project="eng\targets\CSharp.Common.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
<Import Project="eng\targets\Wix.Common.props" Condition="'$(MSBuildProjectExtension)' == '.wixproj'" /> <Import Project="eng\targets\Wix.Common.props" Condition="'$(MSBuildProjectExtension)' == '.wixproj'" />
<Import Project="eng\targets\Npm.Common.props" Condition="'$(MSBuildProjectExtension)' == '.npmproj'" /> <Import Project="eng\targets\Npm.Common.props" Condition="'$(MSBuildProjectExtension)' == '.npmproj'" />
<Import Project="eng\targets\Helix.props" Condition="'$(IsTestProject)' == 'true'" />
</Project> </Project>

View File

@ -163,5 +163,6 @@
<Import Project="eng\targets\Wix.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.wixproj'" /> <Import Project="eng\targets\Wix.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.wixproj'" />
<Import Project="eng\targets\Npm.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.npmproj'" /> <Import Project="eng\targets\Npm.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.npmproj'" />
<Import Project="eng\targets\ReferenceAssembly.targets" Condition=" '$(HasReferenceAssembly)' == 'true' " /> <Import Project="eng\targets\ReferenceAssembly.targets" Condition=" '$(HasReferenceAssembly)' == 'true' " />
<Import Project="eng\targets\Helix.targets" Condition="'$(IsTestProject)' == 'true'" />
</Project> </Project>

View File

@ -221,10 +221,6 @@
<Uri>https://github.com/dotnet/extensions</Uri> <Uri>https://github.com/dotnet/extensions</Uri>
<Sha>396aff55e0b4628a7a44375e4b72e5d19a6e37ab</Sha> <Sha>396aff55e0b4628a7a44375e4b72e5d19a6e37ab</Sha>
</Dependency> </Dependency>
<Dependency Name="Microsoft.CSharp" Version="5.0.0-alpha.1.19563.6" CoherentParentDependency="Microsoft.NETCore.App.Runtime.win-x64">
<Uri>https://github.com/dotnet/corefx</Uri>
<Sha>5cee7c97d602f294e27c582d4dab81ec388f1d7b</Sha>
</Dependency>
<Dependency Name="Microsoft.Win32.Registry" Version="5.0.0-preview.1.20113.7" CoherentParentDependency="Microsoft.NETCore.App.Runtime.win-x64"> <Dependency Name="Microsoft.Win32.Registry" Version="5.0.0-preview.1.20113.7" CoherentParentDependency="Microsoft.NETCore.App.Runtime.win-x64">
<Uri>https://github.com/dotnet/runtime</Uri> <Uri>https://github.com/dotnet/runtime</Uri>
<Sha>0f3f8e1930c28b67f29990126bc2e8527e959a2e</Sha> <Sha>0f3f8e1930c28b67f29990126bc2e8527e959a2e</Sha>

View File

@ -63,14 +63,12 @@
<MicrosoftDotNetGenAPIPackageVersion>5.0.0-beta.20113.3</MicrosoftDotNetGenAPIPackageVersion> <MicrosoftDotNetGenAPIPackageVersion>5.0.0-beta.20113.3</MicrosoftDotNetGenAPIPackageVersion>
<!-- Packages from dotnet/roslyn --> <!-- Packages from dotnet/roslyn -->
<MicrosoftNetCompilersToolsetPackageVersion>3.5.0-beta3-20114-02</MicrosoftNetCompilersToolsetPackageVersion> <MicrosoftNetCompilersToolsetPackageVersion>3.5.0-beta3-20114-02</MicrosoftNetCompilersToolsetPackageVersion>
<!-- Packages from dotnet/core-setup --> <!-- Packages from dotnet/runtime -->
<MicrosoftExtensionsDependencyModelPackageVersion>5.0.0-preview.1.20113.7</MicrosoftExtensionsDependencyModelPackageVersion> <MicrosoftExtensionsDependencyModelPackageVersion>5.0.0-preview.1.20113.7</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftNETCoreAppInternalPackageVersion>5.0.0-preview.1.20113.7</MicrosoftNETCoreAppInternalPackageVersion> <MicrosoftNETCoreAppInternalPackageVersion>5.0.0-preview.1.20113.7</MicrosoftNETCoreAppInternalPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>5.0.0-preview.1.20113.7</MicrosoftNETCoreAppRefPackageVersion> <MicrosoftNETCoreAppRefPackageVersion>5.0.0-preview.1.20113.7</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftNETCoreAppRuntimewinx64PackageVersion>5.0.0-preview.1.20113.7</MicrosoftNETCoreAppRuntimewinx64PackageVersion> <MicrosoftNETCoreAppRuntimewinx64PackageVersion>5.0.0-preview.1.20113.7</MicrosoftNETCoreAppRuntimewinx64PackageVersion>
<NETStandardLibraryRefPackageVersion>2.1.0-preview.1.20113.7</NETStandardLibraryRefPackageVersion> <NETStandardLibraryRefPackageVersion>2.1.0-preview.1.20113.7</NETStandardLibraryRefPackageVersion>
<!-- Packages from dotnet/corefx -->
<MicrosoftCSharpPackageVersion>5.0.0-alpha.1.19563.6</MicrosoftCSharpPackageVersion>
<MicrosoftWin32RegistryPackageVersion>5.0.0-preview.1.20113.7</MicrosoftWin32RegistryPackageVersion> <MicrosoftWin32RegistryPackageVersion>5.0.0-preview.1.20113.7</MicrosoftWin32RegistryPackageVersion>
<MicrosoftWin32SystemEventsPackageVersion>5.0.0-preview.1.20113.7</MicrosoftWin32SystemEventsPackageVersion> <MicrosoftWin32SystemEventsPackageVersion>5.0.0-preview.1.20113.7</MicrosoftWin32SystemEventsPackageVersion>
<SystemComponentModelAnnotationsPackageVersion>5.0.0-preview.1.20113.7</SystemComponentModelAnnotationsPackageVersion> <SystemComponentModelAnnotationsPackageVersion>5.0.0-preview.1.20113.7</SystemComponentModelAnnotationsPackageVersion>
@ -174,6 +172,7 @@
<MicrosoftSymbolUploaderBuildTaskPackageVersion>1.0.0-beta-64023-03</MicrosoftSymbolUploaderBuildTaskPackageVersion> <MicrosoftSymbolUploaderBuildTaskPackageVersion>1.0.0-beta-64023-03</MicrosoftSymbolUploaderBuildTaskPackageVersion>
<MicrosoftVSSDKBuildToolsVersion>15.9.3032</MicrosoftVSSDKBuildToolsVersion> <MicrosoftVSSDKBuildToolsVersion>15.9.3032</MicrosoftVSSDKBuildToolsVersion>
<!-- Stable dotnet/corefx packages no longer updated for .NET Core 3 --> <!-- Stable dotnet/corefx packages no longer updated for .NET Core 3 -->
<MicrosoftCSharpPackageVersion>4.7.0</MicrosoftCSharpPackageVersion>
<SystemBuffersPackageVersion>4.5.0</SystemBuffersPackageVersion> <SystemBuffersPackageVersion>4.5.0</SystemBuffersPackageVersion>
<SystemCodeDomPackageVersion>4.4.0</SystemCodeDomPackageVersion> <SystemCodeDomPackageVersion>4.4.0</SystemCodeDomPackageVersion>
<SystemCommandlineExperimentalPackageVersion>0.3.0-alpha.19317.1</SystemCommandlineExperimentalPackageVersion> <SystemCommandlineExperimentalPackageVersion>0.3.0-alpha.19317.1</SystemCommandlineExperimentalPackageVersion>

View File

@ -0,0 +1,62 @@
<#
.SYNOPSIS
Installs JDK into a folder in this repo.
.DESCRIPTION
This script downloads an extracts the JDK.
.PARAMETER JdkVersion
The version of the JDK to install. If not set, the default value is read from global.json
.PARAMETER Force
Overwrite the existing installation
#>
param(
[string]$JdkVersion,
[Parameter(Mandatory = $false)]
$InstallDir
)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
Set-StrictMode -Version 1
if ($InstallDir) {
$installDir = $InstallDir;
}
else {
$repoRoot = Resolve-Path "$PSScriptRoot\..\.."
$installDir = "$repoRoot\.tools\jdk\win-x64\"
}
$tempDir = "$installDir\obj"
if (-not $JdkVersion) {
$globalJson = Get-Content "$repoRoot\global.json" | ConvertFrom-Json
$JdkVersion = $globalJson.tools.jdk
}
if (Test-Path $installDir) {
if ($Force) {
Remove-Item -Force -Recurse $installDir
}
else {
Write-Host "The JDK already installed to $installDir. Exiting without action. Call this script again with -Force to overwrite."
exit 0
}
}
Remove-Item -Force -Recurse $tempDir -ErrorAction Ignore | out-null
mkdir $tempDir -ea Ignore | out-null
mkdir $installDir -ea Ignore | out-null
Write-Host "Starting download of JDK ${JdkVersion}"
Invoke-WebRequest -UseBasicParsing -Uri "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/java/jdk-${JdkVersion}_windows-x64_bin.zip" -OutFile "$tempDir/jdk.zip"
Write-Host "Done downloading JDK ${JdkVersion}"
Add-Type -assembly "System.IO.Compression.FileSystem"
[System.IO.Compression.ZipFile]::ExtractToDirectory("$tempDir/jdk.zip", "$tempDir/jdk/")
Write-Host "Expanded JDK to $tempDir"
Write-Host "Installing JDK to $installDir"
Move-Item "$tempDir/jdk/jdk-${JdkVersion}/*" $installDir
Write-Host "Done installing JDK to $installDir"
Remove-Item -Force -Recurse $tempDir -ErrorAction Ignore | out-null
if ($env:TF_BUILD) {
Write-Host "##vso[task.prependpath]$installDir\bin"
}

View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Cause the script to fail if any subcommand fails
set -e
pushd .
if [ "$JAVA_HOME" != "" ]; then
echo "JAVA_HOME is set"
exit
fi
java_version=$1
arch=$2
osname=`uname -s`
if [ "$osname" = "Darwin" ]; then
echo "macOS not supported, relying on the machine providing java itself"
exit 1
else
platformarch="linux-$arch"
fi
echo "PlatformArch: $platformarch"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
output_dir="$DIR/java"
url="https://netcorenativeassets.blob.core.windows.net/resource-packages/external/linux/java/jdk-${java_version}_${platformarch}_bin.tar.gz"
echo "Downloading from: $url"
tmp="$(mktemp -d -t install-jdk.XXXXXX)"
cleanup() {
exitcode=$?
if [ $exitcode -ne 0 ]; then
echo "Failed to install java with exit code: $exitcode"
fi
rm -rf "$tmp"
exit $exitcode
}
trap "cleanup" EXIT
cd "$tmp"
curl -Lsfo $(basename $url) "$url"
echo "Installing java from $(basename $url) $url"
mkdir $output_dir
echo "Unpacking to $output_dir"
tar --strip-components 1 -xzf "jdk-${java_version}_${platformarch}_bin.tar.gz" --no-same-owner --directory "$output_dir"
popd

View File

@ -22,7 +22,17 @@ output_dir="$DIR/node"
url="http://nodejs.org/dist/v$node_version/node-v$node_version-$platformarch.tar.gz" url="http://nodejs.org/dist/v$node_version/node-v$node_version-$platformarch.tar.gz"
echo "Downloading from: $url" echo "Downloading from: $url"
tmp="$(mktemp -d -t install-node.XXXXXX)" tmp="$(mktemp -d -t install-node.XXXXXX)"
trap "rm -rf $tmp" EXIT
cleanup() {
exitcode=$?
if [ $exitcode -ne 0 ]; then
echo "Failed to install node with exit code: $exitcode"
fi
rm -rf "$tmp"
exit $exitcode
}
trap "cleanup" EXIT
cd "$tmp" cd "$tmp"
curl -Lsfo $(basename $url) "$url" curl -Lsfo $(basename $url) "$url"
echo "Installing node from $(basename $url) $url" echo "Installing node from $(basename $url) $url"

View File

@ -12,7 +12,8 @@
<Import Project="..\Build.props" /> <Import Project="..\Build.props" />
<ItemGroup> <ItemGroup>
<HelixTargetQueue Include="@(HelixAvailableTargetQueue)" /> <HelixTargetQueue Condition="'$(_UseHelixOpenQueues)' == 'true'" Include="@(HelixAvailableTargetQueue)" />
<HelixTargetQueue Condition="'$(_UseHelixOpenQueues)' != 'true'" Include="@(HelixAvailableTargetQueue->'%(Identity)'->Replace('.Open',''))" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
@ -21,11 +22,13 @@
<IsExternal>true</IsExternal> <IsExternal>true</IsExternal>
<SkipInvalidConfigurations>true</SkipInvalidConfigurations> <SkipInvalidConfigurations>true</SkipInvalidConfigurations>
<MaxRetryCount Condition="'$(MaxRetryCount)' == ''">2</MaxRetryCount> <MaxRetryCount Condition="'$(MaxRetryCount)' == ''">2</MaxRetryCount>
<HelixAccessToken Condition="'$(_UseHelixOpenQueues)' != 'true'">$(HelixApiAccessToken)</HelixAccessToken>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(ContinuousIntegrationBuild)' == 'true' "> <PropertyGroup Condition=" '$(ContinuousIntegrationBuild)' == 'true' ">
<HelixType>ci</HelixType> <HelixType>ci</HelixType>
<Creator>aspnetcore</Creator> <!-- Creator is not valid for internal queues -->
<Creator Condition="'$(_UseHelixOpenQueues)' == 'true'">aspnetcore</Creator>
<HelixBuild>$(BUILD_BUILDNUMBER).$(TargetArchitecture).$(SYSTEM_JOBATTEMPT)</HelixBuild> <HelixBuild>$(BUILD_BUILDNUMBER).$(TargetArchitecture).$(SYSTEM_JOBATTEMPT)</HelixBuild>
<WaitForWorkItemCompletion>true</WaitForWorkItemCompletion> <WaitForWorkItemCompletion>true</WaitForWorkItemCompletion>
<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter> <EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter>
@ -34,8 +37,9 @@
<PropertyGroup Condition=" '$(ContinuousIntegrationBuild)' != 'true' "> <PropertyGroup Condition=" '$(ContinuousIntegrationBuild)' != 'true' ">
<HelixType>dev</HelixType> <HelixType>dev</HelixType>
<Creator>$(USERNAME)</Creator> <!-- Creator is not valid for internal queues -->
<Creator Condition="'$(USERNAME)' == ''">$(USER)</Creator> <Creator Condition="'$(_UseHelixOpenQueues)' == 'true'">$(USERNAME)</Creator>
<Creator Condition="'$(USERNAME)' == '' AND '$(_UseHelixOpenQueues)' == 'true'">$(USER)</Creator>
<HelixBuild>$([System.DateTime]::Now.ToString('yyyyMMddHHmm'))</HelixBuild> <HelixBuild>$([System.DateTime]::Now.ToString('yyyyMMddHHmm'))</HelixBuild>
</PropertyGroup> </PropertyGroup>

View File

@ -38,4 +38,4 @@ $env:BUILD_REPOSITORY_NAME="aspnetcore"
$env:SYSTEM_TEAMPROJECT="aspnetcore" $env:SYSTEM_TEAMPROJECT="aspnetcore"
$HelixQueues = $HelixQueues -replace ";", "%3B" $HelixQueues = $HelixQueues -replace ";", "%3B"
dotnet msbuild $Project /t:Helix /p:IsRequiredCheck=true /p:IsHelixDaily=true /p:HelixTargetQueues=$HelixQueues /p:RunQuarantinedTests=$RunQuarantinedTests dotnet msbuild $Project /t:Helix /p:IsRequiredCheck=true /p:IsHelixDaily=true /p:HelixTargetQueues=$HelixQueues /p:RunQuarantinedTests=$RunQuarantinedTests /p:_UseHelixOpenQueues=true

View File

@ -35,6 +35,5 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="CSharp.ReferenceAssembly.props" Condition="'$(IsReferenceAssemblyProject)' == 'true'" /> <Import Project="CSharp.ReferenceAssembly.props" Condition="'$(IsReferenceAssemblyProject)' == 'true'" />
<Import Project="Helix.props" Condition="'$(IsTestProject)' == 'true'" />
</Project> </Project>

View File

@ -30,5 +30,5 @@
<Import Project="Packaging.targets" /> <Import Project="Packaging.targets" />
<Import Project="ResolveReferences.targets" /> <Import Project="ResolveReferences.targets" />
<Import Project="Helix.targets" Condition="'$(IsTestProject)' == 'true'" />
</Project> </Project>

View File

@ -15,6 +15,8 @@
<RunQuarantinedTests>false</RunQuarantinedTests> <RunQuarantinedTests>false</RunQuarantinedTests>
<IsWindowsHelixQueue>false</IsWindowsHelixQueue> <IsWindowsHelixQueue>false</IsWindowsHelixQueue>
<IsWindowsHelixQueue Condition="$(HelixTargetQueue.Contains('Windows')) or $(HelixTargetQueue.Contains('windows'))">true</IsWindowsHelixQueue> <IsWindowsHelixQueue Condition="$(HelixTargetQueue.Contains('Windows')) or $(HelixTargetQueue.Contains('windows'))">true</IsWindowsHelixQueue>
<IsMacHelixQueue>false</IsMacHelixQueue>
<IsMacHelixQueue Condition="$(HelixTargetQueue.Contains('OSX')) or $(HelixTargetQueue.Contains('macOs'))">true</IsMacHelixQueue>
<HelixTestName>$(MSBuildProjectName)--$(TargetFramework)</HelixTestName> <HelixTestName>$(MSBuildProjectName)--$(TargetFramework)</HelixTestName>
<HelixUseArchive>false</HelixUseArchive> <HelixUseArchive>false</HelixUseArchive>
<LoggingTestingDisableFileLogging Condition="'$(IsHelixJob)' == 'true'">false</LoggingTestingDisableFileLogging> <LoggingTestingDisableFileLogging Condition="'$(IsHelixJob)' == 'true'">false</LoggingTestingDisableFileLogging>
@ -33,16 +35,4 @@
<HelixContent Include="$(RepoRoot)eng\helix\content\**\*" /> <HelixContent Include="$(RepoRoot)eng\helix\content\**\*" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TestDependsOnMssql)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<HelixPreCommand Include="call RunPowershell.cmd mssql\InstallSqlServerLocalDB.ps1 || exit /b 1" />
</ItemGroup>
<ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'false'">
<HelixPreCommand Include="./installnode.sh $(NodeVersion) $(TargetArchitecture)" />
</ItemGroup>
<ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) %25HELIX_CORRELATION_PAYLOAD%25\node\bin || exit /b 1" />
</ItemGroup>
</Project> </Project>

View File

@ -1,10 +1,26 @@
<Project> <Project>
<ItemGroup Condition="'$(TestDependsOnJava)' == 'true'">
<HelixPreCommand Condition="'$(IsWindowsHelixQueue)' == 'true'" Include="call RunPowershell.cmd InstallJdk.ps1 11.0.3 %25HELIX_CORRELATION_PAYLOAD%25\jdk &amp;&amp; set %22JAVA_HOME=%25HELIX_CORRELATION_PAYLOAD%25\jdk%22" />
<HelixPreCommand Condition="'$(IsWindowsHelixQueue)' != 'true' AND '$(IsMacHelixQueue)' != 'true'" Include="./installjdk.sh 10.0.2 x64 &amp;&amp; if [ &quot;%24JAVA_HOME&quot; = &quot;&quot; ]%3B then export JAVA_HOME=%24PWD/java%3B fi" />
</ItemGroup>
<ItemGroup Condition="'$(TestDependsOnMssql)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<HelixPreCommand Include="call RunPowershell.cmd mssql\InstallSqlServerLocalDB.ps1 || exit /b 1" />
</ItemGroup>
<ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'false'">
<HelixPreCommand Include="./installnode.sh $(NodeVersion) $(TargetArchitecture)" />
</ItemGroup>
<ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
<HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) %25HELIX_CORRELATION_PAYLOAD%25\node\bin || exit /b 1" />
</ItemGroup>
<!-- Item group has to be defined here becasue Helix.props is evaluated before xunit.runner.console.props --> <!-- Item group has to be defined here becasue Helix.props is evaluated before xunit.runner.console.props -->
<ItemGroup Condition="$(BuildHelixPayload)"> <ItemGroup Condition="$(BuildHelixPayload)">
<Content Include="@(HelixContent)" /> <Content Include="@(HelixContent)" />
</ItemGroup> </ItemGroup>
<!-- <!--
This target is meant to be used when invoking helix tests on one project at a time. This target is meant to be used when invoking helix tests on one project at a time.
@ -40,6 +56,12 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
<_SelectedPlatforms>@(HelixProjectPlatform)</_SelectedPlatforms> <_SelectedPlatforms>@(HelixProjectPlatform)</_SelectedPlatforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(_UseHelixOpenQueues)' != 'true'">
<_Temp Include="@(HelixAvailableTargetQueue)" />
<HelixAvailableTargetQueue Remove="@(HelixAvailableTargetQueue)" />
<HelixAvailableTargetQueue Include="@(_Temp->'%(Identity)'->Replace('.Open',''))" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<!-- Include default queues based on platform --> <!-- Include default queues based on platform -->
<_HelixProjectTargetQueue Include="%(HelixAvailableTargetQueue.Identity)" Condition="'%(HelixAvailableTargetQueue.Identity)' != '' AND '$(_SelectedPlatforms.Contains(%(Platform)))' == 'true'" /> <_HelixProjectTargetQueue Include="%(HelixAvailableTargetQueue.Identity)" Condition="'%(HelixAvailableTargetQueue.Identity)' != '' AND '$(_SelectedPlatforms.Contains(%(Platform)))' == 'true'" />
@ -71,6 +93,7 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
<_HelixFriendlyNameTargetQueue Condition="$(HelixTargetQueue.Contains('@'))">$(HelixTargetQueue.Substring(1, $([MSBuild]::Subtract($(HelixTargetQueue.LastIndexOf(')')), 1))))</_HelixFriendlyNameTargetQueue> <_HelixFriendlyNameTargetQueue Condition="$(HelixTargetQueue.Contains('@'))">$(HelixTargetQueue.Substring(1, $([MSBuild]::Subtract($(HelixTargetQueue.LastIndexOf(')')), 1))))</_HelixFriendlyNameTargetQueue>
</PropertyGroup> </PropertyGroup>
<!-- Important: If HelixTargetQueue is not removed here, then Publish will occur for every single queue type. And since Publish shouldn't depend on the queue we can just publish once -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_PublishHelixArchive" RemoveProperties="HelixTargetQueue;TestRunId" /> <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_PublishHelixArchive" RemoveProperties="HelixTargetQueue;TestRunId" />
<ConvertToAbsolutePath Paths="$(PublishDir)"> <ConvertToAbsolutePath Paths="$(PublishDir)">
@ -85,6 +108,7 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
<PostCommands>@(HelixPostCommand)</PostCommands> <PostCommands>@(HelixPostCommand)</PostCommands>
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command> <Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command> <Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
<Command Condition="$(HelixCommand) != ''">$(HelixCommand)</Command>
<Timeout>$(HelixTimeout)</Timeout> <Timeout>$(HelixTimeout)</Timeout>
</HelixWorkItem> </HelixWorkItem>
</ItemGroup> </ItemGroup>

View File

@ -119,7 +119,7 @@
<Move SourceFiles="$(_BackupPackageJson)" DestinationFiles="$(PackageJson)" /> <Move SourceFiles="$(_BackupPackageJson)" DestinationFiles="$(PackageJson)" />
</Target> </Target>
<Target Name="Test" Condition="'$(IsTestProject)' == 'true'"> <Target Name="Test" Condition="'$(IsTestProject)' == 'true' AND '$(SkipTests)' != 'true'">
<Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" /> <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" />
<Message Importance="High" Text="Running npm tests for $(MSBuildProjectName)" /> <Message Importance="High" Text="Running npm tests for $(MSBuildProjectName)" />
<Yarn Command="$(NpmTestArgs)" StandardOutputImportance="High" StandardErrorImportance="High" /> <Yarn Command="$(NpmTestArgs)" StandardOutputImportance="High" StandardErrorImportance="High" />

View File

@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
{ {
throw new InvalidOperationException( throw new InvalidOperationException(
"JavaScript interop calls cannot be issued at this time. This is because the component is being " + "JavaScript interop calls cannot be issued at this time. This is because the component is being " +
$"statically rendererd. When prerendering is enabled, JavaScript interop calls can only be performed " + $"statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed " +
$"during the OnAfterRenderAsync lifecycle method."); $"during the OnAfterRenderAsync lifecycle method.");
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Web;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
@ -272,7 +273,7 @@ namespace Microsoft.AspNetCore.Hosting
{ {
if (NameValueHeaderValue.TryParse(item, out var baggageItem)) if (NameValueHeaderValue.TryParse(item, out var baggageItem))
{ {
activity.AddBaggage(baggageItem.Name.ToString(), baggageItem.Value.ToString()); activity.AddBaggage(baggageItem.Name.ToString(), HttpUtility.UrlDecode(baggageItem.Value.ToString()));
} }
} }
} }

View File

@ -345,6 +345,35 @@ namespace Microsoft.AspNetCore.Hosting.Tests
Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2"); Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2");
} }
[Fact]
public void ActivityBaggageValuesAreUrlDecodedFromHeaders()
{
var diagnosticListener = new DiagnosticListener("DummySource");
var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
s =>
{
if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
{
return true;
}
return false;
});
features.Set<IHttpRequestFeature>(new HttpRequestFeature()
{
Headers = new HeaderDictionary()
{
{"Request-Id", "ParentId1"},
{"Correlation-Context", "Key1=value1%2F1"}
}
});
hostingApplication.CreateContext(features);
Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1/1");
}
[Fact] [Fact]
public void ActivityTraceParentAndTraceStateFromHeaders() public void ActivityTraceParentAndTraceStateFromHeaders()

View File

@ -96,7 +96,7 @@ namespace Microsoft.AspNetCore.Http
GetParts(_value, out var host, out var port); GetParts(_value, out var host, out var port);
if (!StringSegment.IsNullOrEmpty(port) if (!StringSegment.IsNullOrEmpty(port)
&& int.TryParse(port.ToString(), NumberStyles.None, CultureInfo.InvariantCulture, out var p)) && int.TryParse(port.AsSpan(), NumberStyles.None, CultureInfo.InvariantCulture, out var p))
{ {
return p; return p;
} }

View File

@ -15,6 +15,7 @@ namespace Microsoft.AspNetCore.Identity
public partial class ClaimsIdentityOptions public partial class ClaimsIdentityOptions
{ {
public ClaimsIdentityOptions() { } public ClaimsIdentityOptions() { }
public string EmailClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string RoleClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public string RoleClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string SecurityStampClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public string SecurityStampClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string UserIdClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public string UserIdClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }

View File

@ -15,6 +15,7 @@ namespace Microsoft.AspNetCore.Identity
public partial class ClaimsIdentityOptions public partial class ClaimsIdentityOptions
{ {
public ClaimsIdentityOptions() { } public ClaimsIdentityOptions() { }
public string EmailClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string RoleClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public string RoleClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string SecurityStampClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public string SecurityStampClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string UserIdClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public string UserIdClaimType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }

View File

@ -25,9 +25,14 @@ namespace Microsoft.AspNetCore.Identity
/// </summary> /// </summary>
public string UserIdClaimType { get; set; } = ClaimTypes.NameIdentifier; public string UserIdClaimType { get; set; } = ClaimTypes.NameIdentifier;
/// <summary>
/// Gets or sets the ClaimType used for the user email claim. Defaults to <see cref="ClaimTypes.Email"/>.
/// </summary>
public string EmailClaimType { get; set; } = ClaimTypes.Email;
/// <summary> /// <summary>
/// Gets or sets the ClaimType used for the security stamp claim. Defaults to "AspNet.Identity.SecurityStamp". /// Gets or sets the ClaimType used for the security stamp claim. Defaults to "AspNet.Identity.SecurityStamp".
/// </summary> /// </summary>
public string SecurityStampClaimType { get; set; } = "AspNet.Identity.SecurityStamp"; public string SecurityStampClaimType { get; set; } = "AspNet.Identity.SecurityStamp";
} }
} }

View File

@ -81,6 +81,14 @@ namespace Microsoft.AspNetCore.Identity
Options.ClaimsIdentity.RoleClaimType); Options.ClaimsIdentity.RoleClaimType);
id.AddClaim(new Claim(Options.ClaimsIdentity.UserIdClaimType, userId)); id.AddClaim(new Claim(Options.ClaimsIdentity.UserIdClaimType, userId));
id.AddClaim(new Claim(Options.ClaimsIdentity.UserNameClaimType, userName)); id.AddClaim(new Claim(Options.ClaimsIdentity.UserNameClaimType, userName));
if (UserManager.SupportsUserEmail)
{
var email = await UserManager.GetEmailAsync(user);
if (!string.IsNullOrEmpty(email))
{
id.AddClaim(new Claim(Options.ClaimsIdentity.EmailClaimType, email));
}
}
if (UserManager.SupportsUserSecurityStamp) if (UserManager.SupportsUserSecurityStamp)
{ {
id.AddClaim(new Claim(Options.ClaimsIdentity.SecurityStampClaimType, id.AddClaim(new Claim(Options.ClaimsIdentity.SecurityStampClaimType,
@ -154,4 +162,4 @@ namespace Microsoft.AspNetCore.Identity
return id; return id;
} }
} }
} }

View File

@ -30,22 +30,33 @@ namespace Microsoft.AspNetCore.Identity.Test
} }
[Theory] [Theory]
[InlineData(false, false, false)] [InlineData(true, false, false, false)]
[InlineData(false, true, false)] [InlineData(true, true, false, false)]
[InlineData(true, false, false)] [InlineData(true, false, true, false)]
[InlineData(true, true, false)] [InlineData(true, true, true, false)]
[InlineData(true, false, true)] [InlineData(false, false, false, true)]
[InlineData(true, true, true)] [InlineData(false, true, false, true)]
public async Task EnsureClaimsIdentityHasExpectedClaims(bool supportRoles, bool supportClaims, bool supportRoleClaims) [InlineData(false, false, false, false)]
[InlineData(false, true, false, false)]
[InlineData(true, false, false, true)]
[InlineData(true, true, false, true)]
[InlineData(true, false, true, true)]
[InlineData(true, true, true, true)]
public async Task EnsureClaimsIdentityHasExpectedClaims(bool supportRoles, bool supportClaims, bool supportRoleClaims, bool supportsUserEmail)
{ {
// Setup // Setup
var userManager = MockHelpers.MockUserManager<PocoUser>(); var userManager = MockHelpers.MockUserManager<PocoUser>();
var roleManager = MockHelpers.MockRoleManager<PocoRole>(); var roleManager = MockHelpers.MockRoleManager<PocoRole>();
var user = new PocoUser { UserName = "Foo" }; var user = new PocoUser { UserName = "Foo", Email = "foo@bar.com" };
userManager.Setup(m => m.SupportsUserClaim).Returns(supportClaims); userManager.Setup(m => m.SupportsUserClaim).Returns(supportClaims);
userManager.Setup(m => m.SupportsUserRole).Returns(supportRoles); userManager.Setup(m => m.SupportsUserRole).Returns(supportRoles);
userManager.Setup(m => m.SupportsUserEmail).Returns(supportsUserEmail);
userManager.Setup(m => m.GetUserIdAsync(user)).ReturnsAsync(user.Id); userManager.Setup(m => m.GetUserIdAsync(user)).ReturnsAsync(user.Id);
userManager.Setup(m => m.GetUserNameAsync(user)).ReturnsAsync(user.UserName); userManager.Setup(m => m.GetUserNameAsync(user)).ReturnsAsync(user.UserName);
if (supportsUserEmail)
{
userManager.Setup(m => m.GetEmailAsync(user)).ReturnsAsync(user.Email);
}
var roleClaims = new[] { "Admin", "Local" }; var roleClaims = new[] { "Admin", "Local" };
if (supportRoles) if (supportRoles)
{ {
@ -90,6 +101,7 @@ namespace Microsoft.AspNetCore.Identity.Test
Assert.Contains( Assert.Contains(
claims, c => c.Type == manager.Options.ClaimsIdentity.UserNameClaimType && c.Value == user.UserName); claims, c => c.Type == manager.Options.ClaimsIdentity.UserNameClaimType && c.Value == user.UserName);
Assert.Contains(claims, c => c.Type == manager.Options.ClaimsIdentity.UserIdClaimType && c.Value == user.Id); Assert.Contains(claims, c => c.Type == manager.Options.ClaimsIdentity.UserIdClaimType && c.Value == user.Id);
Assert.Equal(supportsUserEmail, claims.Any(c => c.Type == manager.Options.ClaimsIdentity.EmailClaimType && c.Value == user.Email));
Assert.Equal(supportRoles, claims.Any(c => c.Type == manager.Options.ClaimsIdentity.RoleClaimType && c.Value == "Admin")); Assert.Equal(supportRoles, claims.Any(c => c.Type == manager.Options.ClaimsIdentity.RoleClaimType && c.Value == "Admin"));
Assert.Equal(supportRoles, claims.Any(c => c.Type == manager.Options.ClaimsIdentity.RoleClaimType && c.Value == "Local")); Assert.Equal(supportRoles, claims.Any(c => c.Type == manager.Options.ClaimsIdentity.RoleClaimType && c.Value == "Local"));
foreach (var cl in userClaims) foreach (var cl in userClaims)

View File

@ -6,8 +6,15 @@ using Microsoft.AspNetCore.ResponseCaching;
namespace Microsoft.AspNetCore.Builder namespace Microsoft.AspNetCore.Builder
{ {
/// <summary>
/// Extension methods for adding the <see cref="ResponseCachingMiddleware"/> to an application.
/// </summary>
public static class ResponseCachingExtensions public static class ResponseCachingExtensions
{ {
/// <summary>
/// Adds the <see cref="ResponseCachingMiddleware"/> for caching HTTP responses.
/// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/>.</param>
public static IApplicationBuilder UseResponseCaching(this IApplicationBuilder app) public static IApplicationBuilder UseResponseCaching(this IApplicationBuilder app)
{ {
if (app == null) if (app == null)

View File

@ -14,6 +14,9 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.ResponseCaching namespace Microsoft.AspNetCore.ResponseCaching
{ {
/// <summary>
/// Enable HTTP response caching.
/// </summary>
public class ResponseCachingMiddleware public class ResponseCachingMiddleware
{ {
private static readonly TimeSpan DefaultExpirationTimeSpan = TimeSpan.FromSeconds(10); private static readonly TimeSpan DefaultExpirationTimeSpan = TimeSpan.FromSeconds(10);
@ -29,6 +32,13 @@ namespace Microsoft.AspNetCore.ResponseCaching
private readonly IResponseCache _cache; private readonly IResponseCache _cache;
private readonly IResponseCachingKeyProvider _keyProvider; private readonly IResponseCachingKeyProvider _keyProvider;
/// <summary>
/// Creates a new <see cref="ResponseCachingMiddleware"/>.
/// </summary>
/// <param name="next">The <see cref="RequestDelegate"/> representing the next middleware in the pipeline.</param>
/// <param name="options">The options for this middleware.</param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> used for logging.</param>
/// <param name="poolProvider">The <see cref="ObjectPoolProvider"/> used for creating <see cref="ObjectPool"/> instances.</param>
public ResponseCachingMiddleware( public ResponseCachingMiddleware(
RequestDelegate next, RequestDelegate next,
IOptions<ResponseCachingOptions> options, IOptions<ResponseCachingOptions> options,
@ -88,6 +98,11 @@ namespace Microsoft.AspNetCore.ResponseCaching
_keyProvider = keyProvider; _keyProvider = keyProvider;
} }
/// <summary>
/// Invokes the logic of the middleware.
/// </summary>
/// <param name="httpContext">The <see cref="HttpContext"/>.</param>
/// <returns>A <see cref="Task"/> that completes when the middleware has completed processing.</returns>
public async Task Invoke(HttpContext httpContext) public async Task Invoke(HttpContext httpContext)
{ {
var context = new ResponseCachingContext(httpContext, _logger); var context = new ResponseCachingContext(httpContext, _logger);

View File

@ -6,15 +6,15 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Connections namespace Microsoft.AspNetCore.Connections
{ {
/// <summary> /// <summary>
/// Represents an end point that multiple connections connect to. For HTTP, endpoints are URLs, for non HTTP it can be a TCP listener (or similar) /// Represents an endpoint that multiple connections connect to. For HTTP, endpoints are URLs, for non-HTTP it can be a TCP listener (or similar).
/// </summary> /// </summary>
public abstract class ConnectionHandler public abstract class ConnectionHandler
{ {
/// <summary> /// <summary>
/// Called when a new connection is accepted to the endpoint /// Called when a new connection is accepted to the endpoint.
/// </summary> /// </summary>
/// <param name="connection">The new <see cref="ConnectionContext"/></param> /// <param name="connection">The new <see cref="ConnectionContext"/></param>
/// <returns>A <see cref="Task"/> that represents the connection lifetime. When the task completes, the connection is complete.</returns> /// <returns>A <see cref="Task"/> that represents the connection lifetime. When the task completes, the connection is complete.</returns>
public abstract Task OnConnectedAsync(ConnectionContext connection); public abstract Task OnConnectedAsync(ConnectionContext connection);
} }
} }

View File

@ -1,4 +1,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>

View File

@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81)] [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81)]
public async Task TlsAlpnHandshakeSelectsHttp2From1and2() public async Task TlsAlpnHandshakeSelectsHttp2From1and2()
{ {
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2
[ConditionalFact] [ConditionalFact]
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81)] [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81)]
public async Task TlsAlpnHandshakeSelectsHttp2() public async Task TlsAlpnHandshakeSelectsHttp2()
{ {

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2
{ {
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")]
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)] [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win10)]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2
public class ShutdownTests : TestApplicationErrorLoggerLoggedTest public class ShutdownTests : TestApplicationErrorLoggerLoggedTest
{ {
private static X509Certificate2 _x509Certificate2 = TestResources.GetTestCertificate(); private static X509Certificate2 _x509Certificate2 = TestResources.GetTestCertificate();
@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2
[CollectDump] [CollectDump]
[ConditionalFact] [ConditionalFact]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/9985", Queues = "Fedora.28.Amd64.Open")] [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/9985", Queues = "Fedora.28.Amd64;Fedora.28.Amd64.Open")]
[Flaky("https://github.com/dotnet/aspnetcore/issues/9985", FlakyOn.All)] [Flaky("https://github.com/dotnet/aspnetcore/issues/9985", FlakyOn.All)]
public async Task GracefulShutdownWaitsForRequestsToFinish() public async Task GracefulShutdownWaitsForRequestsToFinish()
{ {

View File

@ -595,7 +595,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
[InlineData(HttpProtocols.Http2)] [InlineData(HttpProtocols.Http2)]
[InlineData(HttpProtocols.Http1AndHttp2)] [InlineData(HttpProtocols.Http1AndHttp2)]
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")] [OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2 [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10428", Queues = "Debian.8.Amd64;Debian.8.Amd64.Open")] // Debian 8 uses OpenSSL 1.0.1 which does not support HTTP/2
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81)] [MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81)]
public async Task ListenOptionsProtolsCanBeSetAfterUseHttps(HttpProtocols httpProtocols) public async Task ListenOptionsProtolsCanBeSetAfterUseHttps(HttpProtocols httpProtocols)
{ {

View File

@ -14,7 +14,7 @@ namespace Interop.FunctionalTests
// "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492" // "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492"
&& new OSSkipConditionAttribute(OperatingSystems.MacOSX).IsMet && new OSSkipConditionAttribute(OperatingSystems.MacOSX).IsMet
// Debian 8 uses OpenSSL 1.0.1 which does not support ALPN // Debian 8 uses OpenSSL 1.0.1 which does not support ALPN
&& new SkipOnHelixAttribute("https://github.com/dotnet/aspnetcore/issues/10428") { Queues = "Debian.8.Amd64.Open" }.IsMet; && new SkipOnHelixAttribute("https://github.com/dotnet/aspnetcore/issues/10428") { Queues = "Debian.8.Amd64;Debian.8.Amd64.Open" }.IsMet;
} }
} }
} }

View File

@ -2,6 +2,7 @@
.gradletasknamecache .gradletasknamecache
.gradle/ .gradle/
build/ build/
/test-results
.settings/ .settings/
out/ out/
*.class *.class

View File

@ -6,6 +6,7 @@ buildscript {
} }
dependencies { dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.14.0" classpath "com.diffplug.spotless:spotless-plugin-gradle:3.14.0"
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
} }
} }
@ -16,6 +17,7 @@ plugins {
apply plugin: "java-library" apply plugin: "java-library"
apply plugin: "com.diffplug.gradle.spotless" apply plugin: "com.diffplug.gradle.spotless"
apply plugin: 'org.junit.platform.gradle.plugin'
group 'com.microsoft.signalr' group 'com.microsoft.signalr'
@ -64,8 +66,8 @@ spotless {
} }
} }
test { junitPlatform {
useJUnitPlatform() reportsDir file('test-results')
} }
task sourceJar(type: Jar) { task sourceJar(type: Jar) {

View File

@ -1,5 +1,5 @@
<Project DefaultTargets="Build"> <Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.props))\Directory.Build.props" />
<PropertyGroup> <PropertyGroup>
@ -15,6 +15,9 @@
<!-- Disable gradle daemon on CI since the CI seems to try to wait for the daemon to shut down, which it doesn't do :) --> <!-- Disable gradle daemon on CI since the CI seems to try to wait for the daemon to shut down, which it doesn't do :) -->
<GradleOptions Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(GradleOptions) -Dorg.gradle.daemon=false</GradleOptions> <GradleOptions Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(GradleOptions) -Dorg.gradle.daemon=false</GradleOptions>
<PublishDir>$(OutputPath)</PublishDir>
<TestDependsOnJava>true</TestDependsOnJava>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -51,15 +54,37 @@
<Exec Command="./gradlew $(GradleOptions) compileJava" /> <Exec Command="./gradlew $(GradleOptions) compileJava" />
</Target> </Target>
<Target Name="Test"> <Target Name="Test" Condition="'$(SkipTests)' != 'true'">
<Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" /> <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" />
<Message Text="Running Java client tests" Importance="high" /> <Message Text="Running Java client tests" Importance="high" />
<Message Text="> gradlew $(GradleOptions) test" Importance="high" /> <Message Text="> gradlew $(GradleOptions) test" Importance="high" />
<Exec Command="./gradlew $(GradleOptions) test" IgnoreStandardErrorWarningFormat="true" /> <Exec Command="./gradlew $(GradleOptions) test" IgnoreStandardErrorWarningFormat="true" />
</Target> </Target>
<Target Name="Publish">
<ItemGroup>
<Files Include="**/*.java" />
<Files Include="**/gradle-wrapper.jar" />
<Files Include="**/gradle-wrapper.properties" />
<Files Include="gradlew" />
<Files Include="build.gradle" />
<Files Include="gradlew.bat" />
<Files Include="settings.gradle" />
<Files Include="@(Content)" />
</ItemGroup>
<Copy DestinationFiles="@(Files->'$(PublishDir)\%(RecursiveDir)%(FileName)%(Extension)')" SourceFiles="@(Files)" />
</Target>
<PropertyGroup> <PropertyGroup>
<!-- Pass the Java Package Version down to Gradle --> <!-- Pass the Java Package Version down to Gradle -->
<GradleOptions Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(GradleOptions) -PpackageVersion="$(PackageVersion)"</GradleOptions> <GradleOptions Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(GradleOptions) -PpackageVersion="$(PackageVersion)"</GradleOptions>
<HelixCommand>chmod +x ./gradlew &amp;&amp; ./gradlew $(GradleOptions) test</HelixCommand>
<HelixCommand Condition="'$(IsWindowsHelixQueue)' == 'true'">call gradlew $(GradleOptions) test</HelixCommand>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<HelixPostCommand Condition="'$(IsWindowsHelixQueue)' != 'true'" Include="cp %24{HELIX_WORKITEM_ROOT}/test-results/TEST-junit-jupiter.xml %24{HELIX_WORKITEM_ROOT}/junit-results.xml" />
<HelixPostCommand Condition="'$(IsWindowsHelixQueue)' == 'true'" Include="copy %25HELIX_WORKITEM_ROOT%25\test-results\TEST-junit-jupiter.xml %25HELIX_WORKITEM_ROOT%25\junit-results.xml" />
</ItemGroup>
</Project> </Project>

View File

@ -9,6 +9,7 @@
<_TestSauceArgs Condition="'$(BrowserTestHostName)' != ''">$(_TestSauceArgs) --use-hostname "$(BrowserTestHostName)"</_TestSauceArgs> <_TestSauceArgs Condition="'$(BrowserTestHostName)' != ''">$(_TestSauceArgs) --use-hostname "$(BrowserTestHostName)"</_TestSauceArgs>
<NpmTestArgs Condition="'$(DailyTests)' != 'true'">run test:inner --no-color --configuration $(Configuration)</NpmTestArgs> <NpmTestArgs Condition="'$(DailyTests)' != 'true'">run test:inner --no-color --configuration $(Configuration)</NpmTestArgs>
<NpmBuildArgs>run build:inner</NpmBuildArgs> <NpmBuildArgs>run build:inner</NpmBuildArgs>
<BuildHelixPayload>false</BuildHelixPayload>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -18,7 +19,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
<Target Name="Test" Condition="'$(IsTestProject)' == 'true'"> <Target Name="Test" Condition="'$(IsTestProject)' == 'true' AND '$(SkipTests)' != 'true'">
<Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" /> <Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Test" />
<Message Importance="High" Text="Running tests for $(MSBuildProjectName)" /> <Message Importance="High" Text="Running tests for $(MSBuildProjectName)" />
<Yarn Condition="'$(DailyTests)' != 'true'" Command="$(NpmTestArgs)" /> <Yarn Condition="'$(DailyTests)' != 'true'" Command="$(NpmTestArgs)" />

View File

@ -28,7 +28,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public void OpenApi_NoProjectExists() public void OpenApi_NoProjectExists()
{ {
var app = GetApplication(); var app = GetApplication();
@ -40,7 +39,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public void OpenApi_ExplicitProject_Missing() public void OpenApi_ExplicitProject_Missing()
{ {
var app = GetApplication(); var app = GetApplication();
@ -75,7 +73,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Add_ReuseItemGroup() public async Task OpenApi_Add_ReuseItemGroup()
{ {
var project = CreateBasicProject(withOpenApi: true); var project = CreateBasicProject(withOpenApi: true);
@ -105,7 +102,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public void OpenApi_Add_File_EquivilentPaths() public void OpenApi_Add_File_EquivilentPaths()
{ {
var project = CreateBasicProject(withOpenApi: true); var project = CreateBasicProject(withOpenApi: true);
@ -131,7 +127,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Add_NSwagTypeScript() public async Task OpenApi_Add_NSwagTypeScript()
{ {
var project = CreateBasicProject(withOpenApi: true); var project = CreateBasicProject(withOpenApi: true);
@ -152,7 +147,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Add_FromJson() public async Task OpenApi_Add_FromJson()
{ {
var project = CreateBasicProject(withOpenApi: true); var project = CreateBasicProject(withOpenApi: true);
@ -173,7 +167,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Add_File_UseProjectOption() public async Task OpenApi_Add_File_UseProjectOption()
{ {
var project = CreateBasicProject(withOpenApi: true); var project = CreateBasicProject(withOpenApi: true);
@ -194,7 +187,6 @@ namespace Microsoft.DotNet.OpenApi.Add.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Add_MultipleTimes_OnlyOneReference() public async Task OpenApi_Add_MultipleTimes_OnlyOneReference()
{ {
var project = CreateBasicProject(withOpenApi: true); var project = CreateBasicProject(withOpenApi: true);

View File

@ -16,7 +16,6 @@ namespace Microsoft.DotNet.OpenApi.Remove.Tests
public OpenApiRemoveTests(ITestOutputHelper output) : base(output) { } public OpenApiRemoveTests(ITestOutputHelper output) : base(output) { }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Remove_File() public async Task OpenApi_Remove_File()
{ {
var nswagJsonFile = "openapi.json"; var nswagJsonFile = "openapi.json";
@ -62,7 +61,6 @@ namespace Microsoft.DotNet.OpenApi.Remove.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Remove_ViaUrl() public async Task OpenApi_Remove_ViaUrl()
{ {
_tempDir _tempDir
@ -151,7 +149,6 @@ namespace Microsoft.DotNet.OpenApi.Remove.Tests
} }
[Fact] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task OpenApi_Remove_Multiple() public async Task OpenApi_Remove_Multiple()
{ {
var nswagJsonFile = "openapi.json"; var nswagJsonFile = "openapi.json";

View File

@ -19,7 +19,7 @@ namespace Microsoft.Extensions.SecretManager.Tools
public static CommandLineOptions Parse(string[] args, IConsole console) public static CommandLineOptions Parse(string[] args, IConsole console)
{ {
var app = new CommandLineApplication() var app = new CommandLineApplication(treatUnmatchedOptionsAsArguments: true)
{ {
Out = console.Out, Out = console.Out,
Error = console.Error, Error = console.Error,

View File

@ -4,6 +4,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using System.Xml.XPath; using System.Xml.XPath;
using Microsoft.Extensions.CommandLineUtils; using Microsoft.Extensions.CommandLineUtils;
@ -122,7 +123,16 @@ namespace Microsoft.Extensions.SecretManager.Tools.Internal
propertyGroup.Add(new XElement("UserSecretsId", newSecretsId)); propertyGroup.Add(new XElement("UserSecretsId", newSecretsId));
} }
projectDocument.Save(projectPath); var settings = new XmlWriterSettings
{
Indent = true,
OmitXmlDeclaration = true,
};
using (var xw = XmlWriter.Create(projectPath, settings))
{
projectDocument.Save(xw);
}
context.Reporter.Output(Resources.FormatMessage_SetUserSecretsIdForProject(newSecretsId, projectPath)); context.Reporter.Output(Resources.FormatMessage_SetUserSecretsIdForProject(newSecretsId, projectPath));
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Xml.Linq;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Configuration.UserSecrets.Tests; using Microsoft.Extensions.Configuration.UserSecrets.Tests;
using Microsoft.Extensions.SecretManager.Tools.Internal; using Microsoft.Extensions.SecretManager.Tools.Internal;
@ -90,6 +91,18 @@ namespace Microsoft.Extensions.SecretManager.Tools.Tests
Assert.Equal(SecretId, idResolver.Resolve(null, null)); Assert.Equal(SecretId, idResolver.Resolve(null, null));
} }
[Fact]
public void DoesNotAddXmlDeclarationToProject()
{
var projectDir = _fixture.CreateProject(null);
var projectFile = Path.Combine(projectDir, "TestProject.csproj");
new InitCommand(null, null).Execute(MakeCommandContext(), projectDir);
var projectDocument = XDocument.Load(projectFile);
Assert.Null(projectDocument.Declaration);
}
[Fact] [Fact]
public void OverridesIdForProjectWithSecretId() public void OverridesIdForProjectWithSecretId()
{ {

View File

@ -93,7 +93,9 @@ namespace Microsoft.Extensions.SecretManager.Tools.Tests
new KeyValuePair<string, string>("key1", Guid.NewGuid().ToString()), new KeyValuePair<string, string>("key1", Guid.NewGuid().ToString()),
new KeyValuePair<string, string>("Facebook:AppId", Guid.NewGuid().ToString()), new KeyValuePair<string, string>("Facebook:AppId", Guid.NewGuid().ToString()),
new KeyValuePair<string, string>(@"key-@\/.~123!#$%^&*())-+==", @"key-@\/.~123!#$%^&*())-+=="), new KeyValuePair<string, string>(@"key-@\/.~123!#$%^&*())-+==", @"key-@\/.~123!#$%^&*())-+=="),
new KeyValuePair<string, string>("key2", string.Empty) new KeyValuePair<string, string>("key2", string.Empty),
new KeyValuePair<string, string>("-oneDashedKey", "-oneDashedValue"),
new KeyValuePair<string, string>("--twoDashedKey", "--twoDashedValue")
}; };
var projectPath = _fixture.GetTempSecretProject(); var projectPath = _fixture.GetTempSecretProject();