Move to .NET 5 preview.1 (#12140)

This commit is contained in:
Steve Lee
2020-03-19 11:27:13 -07:00
committed by GitHub
parent 5da06978b1
commit 495dea0783
28 changed files with 174 additions and 169 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<Company>Microsoft Corporation</Company>
<Copyright>(c) Microsoft Corporation. All rights reserved.</Copyright>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp5.0</TargetFramework>
<LangVersion>8.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -1009,3 +1009,10 @@ Describe 'Pwsh startup and PATH' -Tag CI {
$path | Should -BeExactly ($PSHOME + [System.IO.Path]::PathSeparator)
}
}
Describe 'Console host name' -Tag CI {
It 'Name is pwsh' -Pending {
# waiting on https://github.com/dotnet/runtime/issues/33673
(Get-Process -id $PID).Name | Should -BeExactly 'pwsh'
}
}
-6
View File
@@ -13,7 +13,6 @@ Describe "Validate start of console host" -Tag CI {
'netstandard.dll'
'Newtonsoft.Json.dll'
'pwsh.dll'
'System.Buffers.dll'
'System.Collections.Concurrent.dll'
'System.Collections.dll'
'System.Collections.NonGeneric.dll'
@@ -23,7 +22,6 @@ Describe "Validate start of console host" -Tag CI {
'System.ComponentModel.TypeConverter.dll'
'System.Console.dll'
'System.Data.Common.dll'
'System.Diagnostics.Debug.dll'
'System.Diagnostics.FileVersionInfo.dll'
'System.Diagnostics.Process.dll'
'System.Diagnostics.TraceSource.dll'
@@ -46,9 +44,7 @@ Describe "Validate start of console host" -Tag CI {
'System.Reflection.Emit.ILGeneration.dll'
'System.Reflection.Emit.Lightweight.dll'
'System.Reflection.Primitives.dll'
'System.Resources.ResourceManager.dll'
'System.Runtime.dll'
'System.Runtime.Extensions.dll'
'System.Runtime.InteropServices.dll'
'System.Runtime.InteropServices.RuntimeInformation.dll'
'System.Runtime.Loader.dll'
@@ -62,7 +58,6 @@ Describe "Validate start of console host" -Tag CI {
'System.Text.Encoding.Extensions.dll'
'System.Text.RegularExpressions.dll'
'System.Threading.dll'
'System.Threading.Tasks.dll'
'System.Threading.Tasks.Parallel.dll'
'System.Threading.Thread.dll'
'System.Threading.ThreadPool.dll'
@@ -76,7 +71,6 @@ Describe "Validate start of console host" -Tag CI {
'System.Management.dll'
'System.Security.Claims.dll'
'System.Security.Cryptography.Primitives.dll'
'System.Security.Principal.dll'
'System.Threading.Overlapped.dll'
)
}
@@ -296,7 +296,6 @@ Describe 'NullConditionalMemberAccess' -Tag 'CI' {
${array}?.length | Should -Be 3
${hash}?.a | Should -Be 1
(Get-Process -Id $PID)?.Name | Should -BeLike "pwsh*"
(Get-Item $TestDrive)?.EnumerateFiles()?.Name | Should -BeExactly 'testfile.txt'
[int32]::MaxValue?.ToString() | Should -BeExactly '2147483647'
@@ -360,8 +359,8 @@ Describe 'NullConditionalMemberAccess' -Tag 'CI' {
It 'Use ?. on a dynamic property name' {
$testContent = @'
$propName = 'Name'
(Get-Process -Id $PID)?.$propName | Should -BeLike 'pwsh*'
$propName = 'SI'
(Get-Process -Id $PID)?.$propName | Should -Be (Get-Process -id $PID).SessionId
${doesNotExist}?.$propName() | Should -BeNullOrEmpty
'@
@@ -22,7 +22,7 @@ Describe "Using of ternary operator" -Tags CI {
@{ Script = { @{name = 'name'}.Contains('name') ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@{ Script = { (Test-Path Env:\NonExist) ? 'true' : 'false' }; ExpectedValue = 'false' }
@{ Script = { (Test-Path Env:\PSModulePath) ? 'true' : 'false' }; ExpectedValue = 'true' }
@{ Script = { $($p = Get-Process -Id $PID; $p.Name -eq 'pwsh') ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@{ Script = { $($p = Get-Process -Id $PID; $p.Id -eq $PID) ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@{ Script = { ($a = 1) ? 2 : 3 }; ExpectedValue = 2 }
@{ Script = { $($a = 1) ? 2 : 3 }; ExpectedValue = 3 }
@{ Script = { (Write-Warning -Message warning -WarningAction SilentlyContinue) ? 1 : 2 }; ExpectedValue = 2 }
@@ -31,7 +31,7 @@ Describe "Using of ternary operator" -Tags CI {
## Condition: unary and binary expression expressions
@{ Script = { -not $IsCoreCLR ? 'Desktop' : 'Core' }; ExpectedValue = 'Core' }
@{ Script = { $PSEdition -eq 'Core' ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@{ Script = { $IsCoreCLR -and (Get-Process -Id $PID).Name -eq 'pwsh' ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@{ Script = { $IsCoreCLR -and (Get-Process -Id $PID).Id -eq $PID ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@{ Script = { $IsCoreCLR -and 'pwsh' -match 'p.*h' ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@{ Script = { 1,2,3 -contains 2 ? 'Core' : 'Desktop' }; ExpectedValue = 'Core' }
@@ -1901,36 +1901,6 @@ Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" {
}
Context "Denial of service" -Tag 'DOS' {
It "Image Parsing" {
$dosUri = Get-WebListenerUrl -Test 'Dos' -query @{
dosType='img'
dosLength='5000'
}
$script:content = ''
[TimeSpan] $timeSpan = Measure-Command {
$response = Invoke-WebRequest -Uri $dosUri
$script:content = $response.content
$response.Images | out-null
}
$script:content | Should -Not -BeNullOrEmpty
# pathological regex
$regex = [RegEx]::new('<img\s+[^>]*>')
[TimeSpan] $pathologicalTimeSpan = Measure-Command {
$regex.Match($content)
}
$pathologicalRatio = $pathologicalTimeSpan.TotalMilliseconds/$timeSpan.TotalMilliseconds
Write-Verbose "Pathological ratio: $pathologicalRatio" -Verbose
# dosLength 4,000 on my 3.5 GHz 6-Core Intel Xeon E5 macpro produced a ratio of 12
# dosLength 5,000 on my 3.5 GHz 6-Core Intel Xeon E5 macpro produced a ratio of 21
# dosLength 10,000 on my 3.5 GHz 6-Core Intel Xeon E5 macpro produced a ratio of 75
# in some cases we will be running in a Docker container with modest resources
$pathologicalRatio | Should -BeGreaterThan 5
}
It "Charset Parsing" {
$dosUri = Get-WebListenerUrl -Test 'Dos' -query @{
dosType='charset'
+1 -1
View File
@@ -624,7 +624,7 @@ function Invoke-OpenCover
[parameter()]$OutputLog = "$HOME/Documents/OpenCover.xml",
[parameter()]$TestPath = "${script:psRepoPath}/test/powershell",
[parameter()]$OpenCoverPath = "$HOME/OpenCover",
[parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/netcoreapp3.1/win7-x64/publish",
[parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/netcoreapp5.0/win7-x64/publish",
[parameter()]$PesterLogElevated = "$HOME/Documents/TestResultsElevated.xml",
[parameter()]$PesterLogUnelevated = "$HOME/Documents/TestResultsUnelevated.xml",
[parameter()]$PesterLogFormat = "NUnitXml",
+1 -1
View File
@@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0-preview.1.20120.5" />
</ItemGroup>
<ItemGroup>