Page 1 of 1

textbox appendtext hang following a clear

Posted: Wed Aug 21, 2019 2:37 pm
by owinsloe
Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.167
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.18362.0

Hi, something very interesting. This is reproducible and quite odd. On a form I have a start button that does some processing and logs progress out to a multiline readonly textbox. This is pretty basic stuff that I have used a number of times. However, during coding I mistakenly added this >$Text += "`n`r"<. Note the newline sequence is back-to-front.

So during the textbox update this sequence appeared to be discarded and the textbox was successfully updated as a result of the subsequent
$textbox6.AppendText("$TimeStamp$text")
$textbox6.AppendText("`r`n")
combination.

So, even with the addition of the erroneous >$Text += "`n`r"< things appeared to work correctly.

However, as the function of this little app is multi-run for different samples, there is a CLEAR button that clears the textbox via the textbox.clear() method.

The clear worked but any attempt to perform further updates to the textbox hung the app, which required it to be killed. I tried using both the text = and appendtext = with the same result.

Removing >$Text += "`n`r"< corrected things.

I dont think a hang situation should occur due to data content.

Cheers

function Log ($Text)
{
$Text += "`n`r"
$TimeStamp = get-date -format "MMM dd, HH:mm:ss "

$textbox6.AppendText("$TimeStamp$Text")
$textbox6.AppendText("`r`n")
}

Re: textbox appendtext hang following a clear

Posted: Wed Aug 21, 2019 3:46 pm
by brittneyr
There is indeed something strange happening here. I was able to reproduce your issue in PowerShell Studio and in the ISE after exporting my test psf to a ps1. I'll investigate further and let you know what I find.