1
Vote

Tile notifications failing due to malformed xml

description

Tile notifications are failing due to malformed xml. Have looked through this and in the WindowsPhoneTilePushNotificationMessage's CreatePayload() method, I changed this line:

""

with

""

and it all works now.

Suggest doing the null check before creating the xml.

comments

rajanadar wrote Feb 24, 2013 at 1:04 AM

hi Scott

thanks for pointing it out.. can you please tell me what line you changed again?

ScottIsAFool wrote Feb 25, 2013 at 4:03 PM

Trying to remember now, not sure what happened to it when I posted it in the issue though. I know I was sending through an empty string for Text1 though and it was giving a malformed xml. Unfortunately I no longer use that code in my project and I don't have the fixed dll to check its source I'm afraid.

This is the code I was using to create the toast with though:
                    var toast = new WindowsPhoneToastPushNotificationMessage
                    {
                        NotificationUri = item.Uri,
                        SupportWindowsPhone7_0 = false,
                        Text1 = "",
                        Text2 = message
                    };

GnrlKnowledge wrote Sep 23, 2013 at 4:14 PM

The Problem in the Malformed XML lays within Line 95 in WindowsPhoneTilePushNotificationMessage.

Just surround this.Id ?? String.Empty with Parantheses:
"<wp:Tile Id=\"" + (this.Id ?? String.Empty) + "\">" +

After that it produces correct XML.