-
Notifications
You must be signed in to change notification settings - Fork 8.2k
AMSI not uninitialized when pwsh is not crossgen'd and the window hosting pwsh (directly or indirectly) gets closed (on Windows) #6862
Copy link
Copy link
Closed
Labels
Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalitythe issue is for cleaning up the code with no impact on functionalityWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
This is either a bug or a Debug.Assert call needs to be reviewed. The VerifyAmsiUninitializeCalled method that is called here has a Debug.Assert violation in the following scenario:
- Debug build (because
Debug.Assertis only enabled in Debug) - The
-CrossGenoption onStart-PSBuildis not used - The ConsoleHost gets closed by the window that is hosting pwsh (can be directly or indirectly, i.e. nested) via the Windows UI (Close button on the window itself or the taskbar) but not via typing
exit
Steps to reproduce
git clone https://github.com/PowerShell/PowerShell.git PowerShellReproIssue6862
cd .\PowerShellReproIssue6862
Import-Module .\build.psm1
Start-PSBootStrap
Start-PSBuild
Invoke-Item "$pwd/src\powershell-win-core\bin\Debug\netcoreapp2.1\win7-x64\publish\pwsh.exe"
# Then close the window via the `X` button or the `Close` option on the taskbarExpected behavior
The window closes normally.
Actual behavior
Debug.Assert failure here

Environment data
(Latest state of master)
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta.3
PSEdition Core
GitCommitId v6.0.0-beta.3-1131-gd07a3e7c2faf3f3489ae80e17cb2f02533c392e6
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalitythe issue is for cleaning up the code with no impact on functionalityWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime