-
Notifications
You must be signed in to change notification settings - Fork 7.7k
AMSI not uninitialized when pwsh is not crossgen'd and the window hosting pwsh (directly or indirectly) gets closed (on Windows) #6862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
/cc @TravisEz13 @PaulHigin Please look the AMSI issue. |
/cc @SteveL-MSFT @dantraMSFT This is just the case about |
Thanks. I'll take a look sometime this week. |
When PowerShell is closed via the console (clicking on window [x]) there is a race condition between PowerShell runspace clean up, the appdomain callback for the AMSI uninit assert check, and the process terminating. I don't believe this code was intended to work for this case, but instead is for the case where PowerShell exits cleanly from the command line (by typing 'exit'). I believe the assert is useful for the cleanly exiting case so it would be good to keep it. It is interesting that we are seeing the assert for the "Invoke-Item" case, when in most other cases the process terminates before the assert can be displayed. |
Thanks for the info. The fact that the assertion failure does not happen when using the |
Note that I still see this happening with the latest changes in master but the likelihood seems to have decreased a bit. |
Continues to annoy. |
I agree. I am beginning to use PSCore6 more than Windows PowerShell and it is very annoying. I think the assert should be removed. I'll check with the AMSI folks and see if it is Ok to ignore the un-initialize on process exit. |
We discussed this briefly this morning and agree that @PaulHigin will submit PR to remove this assert as it's no longer providing value |
I have submitted a PR (#8713). |
@PaulHigin One can use closing keywords in the PR (e.g |
Uh oh!
There was an error while loading. Please reload this page.
This is either a bug or a
Debug.Assert
call needs to be reviewed. TheVerifyAmsiUninitializeCalled
method that is called here has aDebug.Assert
violation in the following scenario:Debug.Assert
is only enabled in Debug)-CrossGen
option onStart-PSBuild
is not usedexit
Steps to reproduce
Expected behavior
The window closes normally.
Actual behavior
Debug.Assert failure here

Environment data
(Latest state of master)
The text was updated successfully, but these errors were encountered: