Xml Problem sending toast notifications to run a WP7 application

Folks, I have a sample application for WP7. I also have a service (WCF) and I have a push notification sender (WPF). Until now, it looked pretty similar to the push notification mechanism that Microsoft installed in the WP7 training kit. When I launch the application and exit the application to return to the main screen, I can successfully send a notification about the toast: it appears at the top, makes a little noise, displays the correct text and launches my application when you touch it.

However, when I send the same message with shell toasts to the application while the application is running in the foreground, I get an error message with an invalid character for the root XML node. This error occurs deep inside WP7, as my toast notification handler is never called, and the debugger cannot show me the line of code that caused the error.

I am using NotificationSenderUtility, which comes with a sample WP7 push notification in the tutorial for sending notifications.

If anyone knows why this is happening or how I can fix it, I would like to know, because I have a demo that I give in the code camp on Saturday, and push notifications should be part of the demo :)

Here's the stack trace I get:

in System.Xml.XmlTextReaderImpl.Throw (exception e) in System.Xml.XmlTextReaderImpl.Throw (Int32 res, String resString, String [] args) in System.Xml.XmlTextReaderImpl.Throw (Int32 res, String resString) in System. Xml.XmlTextReaderImpl.ParseRootLevelWhitespace () in System.Xml.XmlTextReaderImpl.ParseDocumentContent () in System.Xml.XmlTextReaderImpl.Read () in Microsoft.Phone.Notification.ShellObjectChannelInternals.ParseXml` Phone.Notification.ShellObjectChannelInternals.OnNotificationReceived (IntPtr blob, UInt32 blobSize) on Microsoft.Phone.Notification.ShellObjectChannelInternals.ChannelHandler (UInt32 eventType, IntPtr blob1, UInt32 blobSize1, IntPtt.btpntl.btpntl.btpntl.btpntl.btpnt. Bloopl.btpntl.btpnt.btpnt.btn.btpnt. Bloom (Object threadContext) in System.Threading.ThreadPool.WorkItem.doWork (Object o) in System.Threading.Timer.ring ()


,

+3
1
+2

Source: https://habr.com/ru/post/1772565/


All Articles