Causes PowerShell v5 to Freeze with High CPU

Feb 10, 2015 at 3:27 PM
Hello, I use this code quite a bit - thanks a bunch for putting it together. I have started testing it on Windows 10 build 9926, which uses PowerShell v5, and I am finding that it causes PowerShell to freeze up.

Specifically, this seems to occur when you define a class, and then declare a new instance of the class. I have done some debug tracing to pinpoint the problem occurring when the class's SECOND property definition occurs. It's weird because the first property definition seems to go just fine.

Anyone else tested this on PowerShell v5?

FYI: I am at the point where I believe this to be a bug in PowerShell, and I have submitted a bug report via Microsoft Connect (ID 1122637, marked as private).

Let me know if you have any thoughts. If you cannot reproduce, let me know and I can potentially send you some sample code.

Feb 10, 2015 at 3:52 PM
Hi Frank. Thanks for the info. I have not tried V5 yet. I'm still stone age on Win 7 and 2008 R2.

It's been a long time since I worked with code and it was my first project while learning V1. I suspect there are some ineffective techniques but it has been working well enough. I looked to move it into modules but it broke the seemless debug due to module isolation. Even so, I didn't hit it hard.

Was reading on the new Class construct in V5 but it looked weak by comparison. I don't think it supports inheritance for example. I'd love for there to be a real OO implementation in Powershell.

I'm heavy in a Powershell DB versioning I think is a lot better than Roundhouse and should integrate with DSC. I'll be working on it for another month or so.

Keep this thread active as you learn things. I'll look at it when I get a V5 installed.
Feb 10, 2015 at 3:59 PM

Thanks for the reply. I agree 100% that PowerShell needs a better OO implementation. Until then, PSClass will rule the roost!

I will keep you posted on my findings. If this ends up being a bug in PowerShell v5, I am hoping to get a fix in before Windows 10 hits RTM.

Jun 19, 2016 at 4:59 PM
Hi, any chances that this project will be updated for PS5 during the near future?
Jun 20, 2016 at 5:30 AM
No plans to update. While the new V5 class system does not have all the features, it's what I'm using now. Is there some features you think are that important?
Jun 20, 2016 at 8:22 AM
Well not now, but I've planned to learn c#. I was hoping to use most of the c# features for PS but if you don't have any plans for updating (i belive it takes tremendous amount of time for update ) i guess i' will just learn PS5 Classes and stick to what I can use. Thanks for quick reply.
Jun 20, 2016 at 2:10 PM
ALIENQuake and Cash,

Sorry for not updating this thread. I believe Microsoft did address the problem that was preventing this code from working on:
--PowerShell v4 on Windows 8.1 or Windows Server 2012 R2 when KB3000850 was installed
--PowerShell v5 on Windows 10

Once W8.1 and WS2012R2 have KB3000850 installed, they require that KB3093550 be installed.

For Windows 10, just make sure that the OS is fully up to date.

Let me know if you have a problem on other operating systems and I can help try to chase it down.
Jun 20, 2016 at 3:04 PM
Ye, I've test example code and it working without problems \o/