伙计们,我的 WP7 示例应用程序正在运行。我还有一个服务 (WCF) 和一个推送通知发送器 (WPF)。到目前为止,这看起来与微软在 WP7 培训套件中设置的推送通知安排非常相似。当我启动应用程序然后退出应用程序以返回主屏幕时,我能够成功发送 toast 通知 - 它出现在顶部,发出一点噪音,显示正确的文本,并在您启动我的应用程序时点击它。
但是,当我在应用程序在前台运行时向我的应用程序发送相同的 shell toast 通知时,我收到一条错误消息,抱怨根 XML 节点的字符无效。这个错误发生在 WP7 的深处,因为我的 toast 通知处理程序从未被调用,并且调试器无法向我显示生成错误的代码行。
我正在使用培训工具包中的 WP7 推送通知示例附带的 NotificationSenderUtility 来发送通知。
如果有人知道为什么会发生这种情况或我该如何解决它,我很想知道,因为我有一个演示,我将在周六的代码营中进行演示,并且推送通知应该是演示的一部分 :)
这是我得到的堆栈跟踪:
在 System.Xml.XmlTextReaderImpl.Throw(Exception e) 在 System.Xml.XmlTextReaderImpl.Throw(Int32 res, String resString, String[] args) 在 System.Xml.XmlTextReaderImpl.Throw(Int32 res, String resString) 在 System. Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() 在 System.Xml.XmlTextReaderImpl.ParseDocumentContent() 在 System.Xml.XmlTextReaderImpl.Read() 在 Microsoft.Phone.Notification.ShellObjectChannelInternals.ParseXMLToProperties(String xmlString, IDictionary`2&propertyBag) 在 Microsoft.Phone .Notification.ShellObjectChannelInternals.OnNotificationReceived(IntPtr blob, UInt32 blobSize) 在 Microsoft.Phone.Notification.ShellObjectChannelInternals.ChannelHandler(UInt32 eventType, IntPtr blob1, UInt32 blobSize1, IntPtr blob2, UInt32 blobSize2) 在 Microsoft.Phone.Notification.HttpNotificationChannel。System.Threading.ThreadPool.WorkItem.doWork(Object o) 在 System.Threading.Timer.ring() 的 Dispatch(Object threadContext)
谢谢,凯文