GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove AMSI unitialized assert and replace with call to uninitialize by PaulHigin · Pull Request #8713 · PowerShell/PowerShell

Conversation

@PaulHigin

@PaulHigin Paul Higinbotham (PaulHigin) commented Jan 22, 2019

Copy link
Copy Markdown
Contributor

PR Summary

AMSI is not getting uninitialized when a PowerShell shell window is closed by clicking the 'close' button instead of typing 'exit' at the command line, because the final runspace is not being closed. There is an assert checking for AMSI uninitialized during a CLR process exit, and it fires every time the window is closed via the close button. This fix removes the assert and replaces it with a check and call to uninitialize AMSI.

PR Context

The assert is very annoying and does nothing useful.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed
      • Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] to your commit messages if the change is significant or affects feature tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Paul Higinbotham (PaulHigin) added 2 commits January 22, 2019 15:05
@PaulHigin
Remove AMSI unitialized assert and replace with call to uninitialize
851ebc7
@PaulHigin
Code cleanup
514616e
@PaulHigin Paul Higinbotham (PaulHigin) assigned Aditya Patwardhan (adityapatwardhan) Jan 22, 2019
@PaulHigin
Paul Higinbotham (PaulHigin) requested a review from Steve Lee (SteveL-MSFT) January 22, 2019 23:37
@PaulHigin Paul Higinbotham (PaulHigin) mentioned this pull request Jan 22, 2019
AMSI not uninitialized when pwsh is not crossgen'd and the window hosting pwsh (directly or indirectly) gets closed (on Windows) #6862
Closed
adityapatwardhan
Aditya Patwardhan (adityapatwardhan) approved these changes Jan 22, 2019
View reviewed changes
bergmeister
Christoph Bergmeister (bergmeister) approved these changes Jan 23, 2019
View reviewed changes
@iSazonov Ilya (iSazonov) added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Jan 23, 2019
@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit 4a1fc4b into PowerShell:master Jan 23, 2019
@iSazonov

Ilya (iSazonov) commented Jan 24, 2019

Copy link
Copy Markdown
Collaborator

Paul Higinbotham (@PaulHigin) Many thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulHigin
Paul Higinbotham (PaulHigin) deleted the remove-overactive-amsi-assert branch August 5, 2019 21:41
@iSazonov Ilya (iSazonov) mentioned this pull request Jul 16, 2020
AMSI scan should be done outside the static lock #3919
Closed
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@PaulHigin @adityapatwardhan
Remove AMSI unitialized assert and replace with call to uninitialize (P…
b7a9184
…owerShell#8713)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adityapatwardhan Aditya Patwardhan (adityapatwardhan) adityapatwardhan approved these changes
@SteveL-MSFT Steve Lee (SteveL-MSFT) Awaiting requested review from SteveL-MSFT
+1 more reviewer
@bergmeister Christoph Bergmeister (bergmeister) bergmeister approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@adityapatwardhan Aditya Patwardhan (adityapatwardhan)

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@PaulHigin @iSazonov @bergmeister @adityapatwardhan
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.