![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Powershell bug? It seems like a bug to me. > PS> 1..50001 | Out-Null # It's just ok > PS> 1..50002 | Out-Null # hmm... > Bad range expression; 50001 is larger than the maximum size of a range > (=50000 elements). > At line:1 char:4 > + 1..5 <<<< 0002| Out-Null Is this a bug? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Powershell bug? On second line your asking for 50001 elements, but the max size is 50000 elements. So looks right to me. I assume the 50000 element range is just an arbitrary max to prevent people from maxing mem too easy. -- William Stacey [C# MVP] "Jade Lee" <redjadeDOTleeATgmailDOTcom> wrote in message news:%23vTovsaiHHA.4520@TK2MSFTNGP02.phx.gbl... It seems like a bug to me. PS> 1..50001 | Out-Null # It's just ok PS> 1..50002 | Out-Null # hmm... Bad range expression; 50001 is larger than the maximum size of a range (=50000 elements). At line:1 char:4 + 1..5 <<<< 0002| Out-Null Is this a bug? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Powershell bug? > On second line your asking for 50001 elements, but the max size is 50000 elements. So looks right to me. I assume the 50000 element range is just an arbitrary max to prevent people from maxing mem too easy. I wonder why these values would be cached in the first place? Sounds like a design bug. At least the error message is good. An ugly way to get around this bug, though you probably already knew this and it wasn't your point... $(for ($i = 0; $i -lt 50002; $i++) { $i } ) | out-null Mike |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Powershell bug? the 50,000 is a limit set by MS.. if it were 32768, 65536, 4gb or something i might understand, but it seems a little contrived to me. however maybe they were scared that people would do things that would just put too many items into the pipelien by mistake?, anyhow i can't see any good reason for it however the fact that 1..50001 doesn't error out is interesting, this looks like a typical "one bug". thought at least its benign. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Powershell bug? PoSH> (0..5000).count 5001 <klumsy@xtra.co.nz> wrote in message news:1177803048.479053.209440@n76g2000hsh.googlegroups.com... > the 50,000 is a limit set by MS.. if it were 32768, 65536, 4gb or > something i might understand, but it seems a little contrived to me. > however maybe they were scared that people would do things that would > just put too many items into the pipelien by mistake?, anyhow i can't > see any good reason for it > > however the fact that > > 1..50001 doesn't error out is interesting, this looks like a typical > "one bug". thought at least its benign. > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Powershell bug? Jade Lee ¾´ ±Û: > It seems like a bug to me. >> PS> 1..50001 | Out-Null # It's just ok >> PS> 1..50002 | Out-Null # hmm... >> Bad range expression; 50001 is larger than the maximum size of a >> range (=50000 elements). >> At line:1 char:4 >> + 1..5 <<<< 0002| Out-Null > Is this a bug? Thanks ^^* range : 1 ~ 50000 The sum of elements : 50001 Is it a right? The statements "(=50000 elements)" confused me just a little. |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Powershell bug? I think it's a bit of stretch to call this a feature. Ranges are constrained to 50,000. "Jade Lee" <redjadeDOTleeATgmailDOTcom> wrote in message news:eqXl6NniHHA.4496@TK2MSFTNGP05.phx.gbl... Jade Lee ¾´ ±Û: It seems like a bug to me. PS> 1..50001 | Out-Null # It's just ok PS> 1..50002 | Out-Null # hmm... Bad range expression; 50001 is larger than the maximum size of a range (=50000 elements). At line:1 char:4 + 1..5 <<<< 0002| Out-Null Is this a bug? Thanks ^^* range : 1 ~ 50000 The sum of elements : 50001 Is it a right? The statements "(=50000 elements)" confused me just a little. |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Powershell bug? yep but we did it based on one (1..5001).count 5000 also it doesn't matter one or o based, it errors our when its greater than 50001 rather tha 50,000 i.e 5..50005 |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Powershell bug? Not sure you want to allow 1..[int]::maxvalue either as people would be crashing themselfs. So you need to pick some max. As shown in the thread, there are othe ways around it if you really need that many. You could also create your own range function and put it in your profile. -- William Stacey [C# MVP] PCR concurrency library: www.codeplex.com/pcr PSH Scripts Project www.codeplex.com/psobject "Doug" <doug.sluis@gmail.com> wrote in message news:u4qdnfAsG6XSJqvbnZ2dnUVZ_jOdnZ2d@comcast.com... I think it's a bit of stretch to call this a feature. Ranges are constrained to 50,000. "Jade Lee" <redjadeDOTleeATgmailDOTcom> wrote in message news:eqXl6NniHHA.4496@TK2MSFTNGP05.phx.gbl... Jade Lee ¾´ ±Û: It seems like a bug to me. PS> 1..50001 | Out-Null # It's just ok PS> 1..50002 | Out-Null # hmm... Bad range expression; 50001 is larger than the maximum size of a range (=50000 elements). At line:1 char:4 + 1..5 <<<< 0002| Out-Null Is this a bug? Thanks ^^* range : 1 ~ 50000 The sum of elements : 50001 Is it a right? The statements "(=50000 elements)" confused me just a little. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |