textbox appendtext hang following a clear

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
owinsloe
Posts: 161
Last visit: Mon Apr 01, 2024 3:01 pm
Been upvoted: 1 time

textbox appendtext hang following a clear

Post 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")
}
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: textbox appendtext hang following a clear

Post 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.
Brittney
SAPIEN Technologies, Inc.
This topic is 4 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.