Please confirm these before moving forward
UniGetUI Version
3.1.6
Windows version, edition, and architecture
Win 11 24H2
Describe your issue
My system was starting to crawl when I noticed that there were hundreds, or more, child conhost/PowerShell (7) child processes still active. Looking at the code here, https://github.com/marticliment/UniGetUI/blob/main/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs#L59, I noticed that Dispose is never called on the Process, either directly or in a using block. This is likely the culprit.
As you can see in the Remarks section of the docs, they emphasize the need to call Dispose to ensure handles aren't leaked: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process?view=net-9.0&redirectedfrom=MSDN#remarks.
The docs for Process.WaitForExit also explicitly says to call Close after to free up resources, and Process.Close says that its Dispose method will call Close for you.
This issue may be present in other areas of the code--all Process instances need to be Disposed.
I recommend to enable the CA2000: Dispose objects before losing scope analyzer to help catch these going forward. https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2000
Steps to reproduce the issue
Leave Uniget UI running for a while and notice the buildup of running child processes
UniGetUI Log
Package Managers Logs
Relevant information
n/a - this bug is self-evident by reading the code.
Screenshots and videos
No response
Please confirm these before moving forward
UniGetUI Version
3.1.6
Windows version, edition, and architecture
Win 11 24H2
Describe your issue
My system was starting to crawl when I noticed that there were hundreds, or more, child conhost/PowerShell (7) child processes still active. Looking at the code here, https://github.com/marticliment/UniGetUI/blob/main/src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs#L59, I noticed that
Disposeis never called on theProcess, either directly or in ausingblock. This is likely the culprit.As you can see in the Remarks section of the docs, they emphasize the need to call
Disposeto ensure handles aren't leaked: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process?view=net-9.0&redirectedfrom=MSDN#remarks.The docs for Process.WaitForExit also explicitly says to call
Closeafter to free up resources, and Process.Close says that itsDisposemethod will callClosefor you.This issue may be present in other areas of the code--all
Processinstances need to be Disposed.I recommend to enable the
CA2000: Dispose objects before losing scopeanalyzer to help catch these going forward. https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2000Steps to reproduce the issue
Leave Uniget UI running for a while and notice the buildup of running child processes
UniGetUI Log
Package Managers Logs
Relevant information
n/a - this bug is self-evident by reading the code.
Screenshots and videos
No response