Powershell: Unreachable code in CustomShellCommands.cs

Created on 23 Jul 2020  路  6Comments  路  Source: PowerShell/PowerShell

First-Time-Issue Issue-Code Cleanup Resolution-Fixed Up-for-Grabs

Most helpful comment

Yikes. Good find. It does look like it is a temporary disabling of this idle timeout fix up code. It also appears to have always been in the Core code base, and is there when first forked from Windows PowerShell. I strongly dislike this kind of code, especially without any comment to indicate why it is there and why it is disabled.

The fix up code appears to order setting WSMan drive idle/maxidle timeout values to ensure an error occurs if idle exceeds maxidle. It seems way over complex, which may be why it is disabled.

My inclination is to remove this code since the behavior has been like this for a long time, and there have been no complaints.

All 6 comments

I can't tell if that's a bug or it was intentionally excluded. Hard to imagine it was accidental with the offending definition being right there. @PaulHigin probably has the best understanding of what needs to happen here.

Yikes. Good find. It does look like it is a temporary disabling of this idle timeout fix up code. It also appears to have always been in the Core code base, and is there when first forked from Windows PowerShell. I strongly dislike this kind of code, especially without any comment to indicate why it is there and why it is disabled.

The fix up code appears to order setting WSMan drive idle/maxidle timeout values to ensure an error occurs if idle exceeds maxidle. It seems way over complex, which may be why it is disabled.

My inclination is to remove this code since the behavior has been like this for a long time, and there have been no complaints.

Yikes. Good find. It does look like it is a temporary disabling of this idle timeout fix up code.

I'm not sure about this theory as idleTimeOut is never reassigned.

Do any maintainers have ability to check Windows PowerShell code for the intent behind this?

This is just an adjustment to the order of setting idle timeout and max idletimeout that has been disabled. The configuration quotas are still set. It is the same in WindowsPowerShell and I feel this code can be safely removed.

@iSazonov I have opened PR, can you update labels?

:tada:This issue was addressed in #13316, which has now been successfully released as v7.1.0-preview.6.:tada:

Handy links:

Was this page helpful?
0 / 5 - 0 ratings