It's crazy a such a simple script, which is actually the same as 6 years ago, can produce a BSOD in a deterministic way with the latest update of Windows. And nobody at MS seems to care about it.
Fix was previously included in https://support.microsoft.com/en-us/topic/june-27-2017-kb402....
> Addressed issue (Error 0x7F) with Windows Forms (WinForms) that causes the system to crash after upgrading to the Creators Update.