Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM mcr.microsoft.com/dotnet/core/sdk:3.1.102
FROM mcr.microsoft.com/dotnet/core/sdk:5.0.0-preview.1.20120.5

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": ".NET Core 3.1, including pwsh (Debian 10)",
"name": ".NET Core 5.0, including pwsh (Debian 10)",
"dockerFile": "Dockerfile",

// Uncomment the next line to run commands after the container is created.
Expand Down
2 changes: 1 addition & 1 deletion PowerShell.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,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>
Expand Down
174 changes: 115 additions & 59 deletions assets/files.wxs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,8 @@ function New-PSOptions {
[ValidateSet("Debug", "Release", "CodeCoverage", '')]
[string]$Configuration,

[ValidateSet("netcoreapp3.1")]
[string]$Framework = "netcoreapp3.1",
[ValidateSet("netcoreapp5.0")]
[string]$Framework = "netcoreapp5.0",

# These are duplicated from Start-PSBuild
# We do not use ValidateScript since we want tab completion
Expand Down Expand Up @@ -2410,7 +2410,7 @@ function Copy-PSGalleryModules
Restore-PSPackage -ProjectDirs (Split-Path $CsProjPath) -Force:$Force.IsPresent

$cache = dotnet nuget locals global-packages -l
if ($cache -match "info : global-packages: (.*)") {
if ($cache -match "global-packages: (.*)") {
$nugetCache = $Matches[1]
}
else {
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.1.102"
"version": "5.0.100-preview.1.20155.7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

<ItemGroup>
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="5.0.0-preview.1.20120.5" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.5.0" />
<PackageReference Include="System.Threading.AccessControl" Version="4.7.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Threading.AccessControl" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Drawing.Common" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="NJsonSchema" Version="10.1.8" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.Diagnostics.EventLog" Version="4.7.0" />
<PackageReference Include="System.Diagnostics.EventLog" Version="5.0.0-preview.1.20120.5" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<!-- the following package(s) are from https://github.com/dotnet/fxdac -->
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.IO.Packaging" Version="4.7.0" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="4.7.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="4.7.0" />
<PackageReference Include="System.IO.Packaging" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.0-preview.1.20120.5" />
<!-- the following package(s) are from https://github.com/dotnet/wcf -->
<PackageReference Include="System.ServiceModel.Duplex" Version="4.7.0" />
<PackageReference Include="System.ServiceModel.Http" Version="4.7.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
<ProjectReference Include="..\Microsoft.WSMan.Runtime\Microsoft.WSMan.Runtime.csproj" />
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="5.0.0-preview.1.20120.5" />
</ItemGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/ResGen/ResGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Generates C# typed bindings for .resx files</Description>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp5.0</TargetFramework>
<AssemblyName>resgen</AssemblyName>
<OutputType>Exe</OutputType>
<TieredCompilation>true</TieredCompilation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
<!-- the Application Insights package -->
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.13.1" />
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="4.7.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
<PackageReference Include="System.DirectoryServices" Version="4.7.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.7.0" />
<PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
<PackageReference Include="System.Security.AccessControl" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="4.7.0" />
<PackageReference Include="System.Security.Permissions" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.DirectoryServices" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Management" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Security.AccessControl" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Security.Permissions" Version="5.0.0-preview.1.20120.5" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0-preview.1.20120.5" />
<!-- the following package(s) are from the powershell org -->
<PackageReference Include="Microsoft.Management.Infrastructure" Version="2.0.0" />
<PackageReference Include="Microsoft.PowerShell.Native" Version="7.0.0" />
Expand Down
27 changes: 3 additions & 24 deletions src/System.Management.Automation/security/nativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ internal struct WINTRUST_BLOB_INFO
internal uint cbStruct;

/// GUID->_GUID
internal GUID gSubject;
internal Guid gSubject;

/// LPCWSTR->WCHAR*
[MarshalAsAttribute(UnmanagedType.LPWStr)]
Expand All @@ -827,23 +827,6 @@ internal struct WINTRUST_BLOB_INFO
internal System.IntPtr pbMemSignedMsg;
}

[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct GUID
{
/// unsigned int
internal uint Data1;

/// unsigned short
internal ushort Data2;

/// unsigned short
internal ushort Data3;

/// unsigned char[8]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
internal byte[] Data4;
}

[ArchitectureSensitive]
internal static WINTRUST_FILE_INFO InitWintrustFileInfoStruct(string fileName)
{
Expand All @@ -864,11 +847,7 @@ internal static WINTRUST_BLOB_INFO InitWintrustBlobInfoStruct(string fileName, s
byte[] contentBytes = System.Text.Encoding.Unicode.GetBytes(content);

// The GUID of the PowerShell SIP
bi.gSubject.Data1 = 0x603bcc1f;
bi.gSubject.Data2 = 0x4b59;
bi.gSubject.Data3 = 0x4e08;
bi.gSubject.Data4 = new byte[] { 0xb7, 0x24, 0xd2, 0xc6, 0x29, 0x7e, 0xf3, 0x51 };

bi.gSubject = new Guid(0x603bcc1f, 0x4b59, 0x4e08, new byte[] { 0xb7, 0x24, 0xd2, 0xc6, 0x29, 0x7e, 0xf3, 0x51 });
bi.cbStruct = (DWORD)Marshal.SizeOf(bi);
bi.pcwszDisplayName = fileName;
bi.cbMemObject = (uint)contentBytes.Length;
Expand Down Expand Up @@ -1988,7 +1967,7 @@ internal struct CRYPTCATMEMBER
internal string pwszReferenceTag;
[MarshalAs(UnmanagedType.LPWStr)]
internal string pwszFileName;
internal GUID gSubjectType;
internal Guid gSubjectType;
internal DWORD fdwMemberFlags;
internal IntPtr pIndirectData;
internal DWORD dwCertVersion;
Expand Down
2 changes: 1 addition & 1 deletion src/TypeCatalogGen/TypeCatalogGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Generates CorePsTypeCatalog.cs given powershell.inc</Description>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp5.0</TargetFramework>
<AssemblyName>TypeCatalogGen</AssemblyName>
<OutputType>Exe</OutputType>
<TieredCompilation>true</TieredCompilation>
Expand Down
2 changes: 1 addition & 1 deletion test/Test.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
7 changes: 7 additions & 0 deletions test/powershell/Host/ConsoleHost.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 0 additions & 6 deletions test/powershell/Host/Startup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
)
}
Expand Down
5 changes: 2 additions & 3 deletions test/powershell/Language/Operators/NullConditional.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
'@
Expand Down
4 changes: 2 additions & 2 deletions test/powershell/Language/Operators/TernaryOperator.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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' }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion test/tools/OpenCover/OpenCover.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/tools/WebListener/WebListener.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading