Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Constructor Intended Use
Avatar
Jro #1
Member since Feb 2010 · 27 posts
Group memberships: Members
Show profile · Link to this post
Subject: PubSubManager
Is the intended use of the PubSubManager constructor different from the desktop sample?  If I instantiate PubSubManager prior to login, my use of the manager's publish will result in an XMPP Null Reference error, and while I see the XML in the OnSend event, it does not truly reach the server.  The XMPP connection will still function, and if I make additional publishes I will see the XML go out on the OnSend XML, but it does not reach the server.  The rest of my pubsub functionality does not use the pubsub manager but rather general IQs/Sends and those work fine.  The last XML that I see is:

<iq id="MX_12" to="pubsub.folka" type="set" xmlns="jabber:client">
  <pubsub xmlns="http://jabber.org/protocol/pubsub">
    <publish node="EditNode">
      <item>
        <entry xmlns="">
          <SubjectID>1</SubjectID>
          <Editing>true</Editing>
          <LastUpdate>2010-06-24T14:29:29-07:00</LastUpdate>
        </entry>
      </item>
    </publish>
  </pubsub>
</iq>

This is identical to what I see when I don't get a null reference exception by creating the pubsubmanager post-login.

If I create the PubSubManager (and set its xmppClient) after the xmppClient is connected, then I do not experience the above.  However, I have issues if messages are coming in at the time following the Constructor (OnMessage is firing), I will experience a general WinMo error (the vague, unhelpful kind).  In the debugger, I see no exceptions thrown inside the library and after a lot of debugging I have found I experience no crashes if I simply disable the creation of the pubsubmanager call in my code (as a counter test, I disabled all of my pubsub functionality except the creation of the pubsubmanager and still experienced the same behavior).
This post was edited 2 times, last on 2010-06-25, 18:54 by Jro.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
most of the PubSubManager code is exactly the same on Destkop and Mobile. For Desktop there is only some additional designer code for the toolbox. When you drop it on a form from the toolbox it get the XmppClient automatically when there is one on the same form.

A XmppClient must be set, and it should not be null. All it does internal is call the Send or IqGrabber.Send functions of the XmppClient. When the XmppClient is not set then it throws a PropertyNotSetException when you should be able to catch with a try/catch block.

At the moment I have no idea what could cause such exceptions. In your debug the <entry/> tag has an empty namespace, maybe Xml to LinQ doesn't like it on the CF. But I don't think this empty namepace can cause such problems.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: