◐ Shell
clean mode source ↗

Change CommandInfoCache to implement IDisposable and clean up the runspace pool by JamesWTruher · Pull Request #1335 · PowerShell/PSScriptAnalyzer

The Helper is recreated with every invocation of Invoke-ScriptAnalyzer which essentially resulted in a runspace which was not cleaned up for every invocation.
I saw 100s of runspaces (ia get-runspace) in my session. I also gave the CommandInfoCache it's own runspace pool and implemented IDisposable in it.
Lastly, I've added a test to catch this in the future.

rjmholt

bergmeister

It no longer needs to be IDisposable
Implement dispose in cache along suggested guidelines

bergmeister

bergmeister

bergmeister

bergmeister

Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>
Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>
Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>

bergmeister

Co-Authored-By: Christoph Bergmeister [MVP] <c.bergmeister@gmail.com>

bergmeister

@JamesWTruher JamesWTruher changed the title Change helper to implement IDisposable and clean up the runspace pool Change CommandInfoCache to implement IDisposable and clean up the runspace pool

Sep 12, 2019

bergmeister

@JamesWTruher

bergmeister