Certain characters crash the notification system
Hello! I have a chatbot and when the following text is sent, it crashes my whole bot.
" βΊACTION π€ New FOLLOW(S) β€ username β€, WELCOME! (1255 followers) (+19).βΊ"
We think it's that smiley π€
Interesting... What OS is this? This module doesn't do much beyond turning around and calling into another PowerShell module per-platform.
Mac from my understanding.
@potatoqualitee Are you able to try with the raw MacNotify module (should already be installed as a dependency of this module)?
Function to use would be Invoke-AlerterNotification
This was on Windows 10; @potatoqualitee 's bot sends the message to PoshNotify and then gets an exception to do with XML. I'll take a look later too.
Not sure if she recorded her str but it's on there ;)
If it was Windows 10, @potatoqualitee, which version of PowerShell was it?
I have a hunch what the issue will be in Windows... but it won't be the emoji π

Thank you, everyone! Such a fast response π I arm running PS version 5.1.19041.610
Maybe I need to throw a .Trim() on that? Something about the /me on Twitch is killing the notifier.
If you've got a copy of the error handy (even a screenshot from the stream), I can dive in a bit
It's the weirdest error, but doesn't happen if I remove the notify
PSMessageDetails :
Exception : System.Management.Automation.RuntimeException:
Cannot read stream: Exception calling "LoadXml" with
"1" argument(s): "Exception from HRESULT: 0xC00CE508"
TargetObject : Cannot read stream: Exception calling "LoadXml" with
"1" argument(s): "Exception from HRESULT: 0xC00CE508"
CategoryInfo : OperationStopped: (Cannot read str...LT:
0xC00CE508":String) [], RuntimeException
FullyQualifiedErrorId : Cannot read stream: Exception calling "LoadXml" with
"1" argument(s): "Exception from HRESULT: GetStream 0xC00CE508"
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Wait-TvResponse<Process>, <No file>: line 102
at Start-TvBot<Process>, <No file>: line 86
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
how it's related, I have no idea
Ohh maybe it's .NET
Hmm. That's a new one for me, and I can't repro π€
@potatoqualitee; what happens if you send just the string to PoshNotify? I was going to test but I don't think your latest code is up.
I'll try that on stream momentarily - I just pushed the code to a PR https://github.com/potatoqualitee/tvbot/pull/7/files#diff-3d86d59729663fe1cebc7fca9f571b09cdf789a4d106d0ddbf2e6c71a36301e0R52
ah ha!
Send-OSNotification -Title gzb -Body "< sup"
Exception calling "LoadXml" with "1" argument(s): "Exception from HRESULT: 0xC00CE513"
At C:\Users\ctrlb\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.3\Private\Pop-WindowsNotification.ps1:46 char:5
+ $ToastXml.LoadXml($XmlString)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Exception
Exception calling "Show" with "1" argument(s): "The parameter is incorrect.
The parameter is incorrect.
... I need to escape some shiz π
In all seriousness, I'd originally made it so that this didn't need to take a dependency on BurntToast. That will change now to fix the 7.1+ issue... and it should also fix this.
thank you! we ended up escaping and fixing that issue but now we're back to working on .. if we type out emojis it works, but if it's passed emojis by the parsed IRC output, it dies π€
Hmm. Any visible difference on the string being passed into Title/Body?
we figured it out!! well, @vexx32 did :D :D :D :D :D let me get you the code that we used
$xml = [System.Security.SecurityElement]::Escape($message)
$string = $xml -replace '\x01'
Send-OSNotification -Title $user -Body $string
Format-Hex is the only way sometimes. π
Pesky control characters hidden in the string.