Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
roseline2 #1
Member since May 2012 · 8 posts
Group memberships: Members
Show profile · Link to this post
Subject: retrieve rooms
Hi
I want to retrieve the rooms in “conference.jabber.org” but I often get an error message: “A first chance exception of type '_?' occurred in Matrix.dll” and then used to get an OnClose event. This is my code:

  1. protected override void OnNavigatedTo(NavigationEventArgs e)
  2. {  
  3.     base.OnNavigatedTo(e);
  4.     dm = new DiscoManager(GloApp.xmppClient);
  5.     dm.DiscoverItems("conference.jabber.org", new EventHandler<IqEventArgs>(DiscoItemsResult));    
  6. }
  7.  
  8. void DiscoItemsResult(object sender, IqEventArgs e)
  9. {
  10.     var query = e.Iq.Element<Matrix.Xmpp.Disco.Items>();
  11.     if (query != null)
  12.     {
  13.         foreach (var itm in query.GetItems())
  14.         {              
  15.    System.Diagnostics.Debug.WriteLine(itm.Jid);
  16.          roomListBox.Items.Add(itm.Jid);
  17.         }
  18.     }
  19. }

What is the problem? Can anyone help me? Thanks
This post was edited on 2012-06-07, 17:58 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by roseline2:
What is the problem? Can anyone help me? Thanks

The complete Stacktrace and XML log would help to locate the problem.

I think your problem is in this code:
  1. roomListBox.Items.Add(itm.Jid);

MatriX does nothing after DiscoItemsResult is calles. It give you only one big XmlElement which you for enumerating the rooms.

Alex
Avatar
roseline2 #3
Member since May 2012 · 8 posts
Group memberships: Members
Show profile · Link to this post
Thank you for your reply but that's not the problem and I need to save the rooms. This is my xml log:

  1. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="jabber.org" version="1.0" >
  2. REC: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="jabber.org" id="7b4fe27011b75692" version="1.0" >
  3. REC: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  4.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  5.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  6.     <mechanism>CRAM-MD5</mechanism>
  7.     <mechanism>LOGIN</mechanism>
  8.     <mechanism>PLAIN</mechanism>
  9.     <mechanism>DIGEST-MD5</mechanism>
  10.     <mechanism>SCRAM-SHA-1</mechanism>
  11.  </mechanisms>
  12.  <compression xmlns="http://jabber.org/features/compress">
  13.     <method>zlib</method>
  14.  </compression>
  15.  <ver xmlns="urn:xmpp:features:rosterver">
  16.     <optional />
  17.  </ver>
  18. </stream:features>
  19. SEND: <auth mechanism="SCRAM-SHA-1" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">biwsbj1yb3NlbGluZSxyPWRSaGlsNm82dFltUzU5V080bVR5QWdLdHFlNkhGTTBr</auth>
  20. REC: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cj1kUmhpbDZvNnRZbVM1OVdPNG1UeUFnS3RxZTZIRk0wa1ZxMkNvMGtpUG5GanRycW9rZ0poSC96SGxNcjRYTnFFLHM9RERmdk9oQlNNakNuVFh1RG1aTmRPdz09LGk9NDA5Ng==</challenge>
  21. SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9ZFJoaWw2bzZ0WW1TNTlXTzRtVHlBZ0t0cWU2SEZNMGtWcTJDbzBraVBuRmp0cnFva2dKaEgvekhsTXI0WE5xRSxwPVUrY0ZLME52NG45MXBQaVJSZ0NqSllNMnp2UT0=</response>
  22. REC: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dj1LWHZHNnZON3dHcXNsbEt4dzgreHo1MGd3OWc9</success>
  23. OnLogin
  24. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="jabber.org" version="1.0" >
  25. REC: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="jabber.org" id="8238e2cbb7a38cb8" version="1.0" >
  26. REC: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  27.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  28.     <required />
  29.  </bind>
  30.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  31.  <compression xmlns="http://jabber.org/features/compress">
  32.     <method>zlib</method>
  33.  </compression>
  34.  <ver xmlns="urn:xmpp:features:rosterver">
  35.     <optional />
  36.  </ver>
  37. </stream:features>
  38. SEND: <iq id="MX_1" type="set" xmlns="jabber:client">
  39.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  40.     <resource>Matrix Windows Phone</resource>
  41.  </bind>
  42. </iq>
  43. REC: <iq to="roseline@jabber.org/Matrix Windows Phone" type="result" id="MX_1" xmlns="jabber:client">
  44.  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
  45.     <jid>roseline@jabber.org/Matrix Windows Phone</jid>
  46.  </bind>
  47. </iq>
  48. SEND: <iq id="MX_2" type="set" xmlns="jabber:client">
  49.  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  50. </iq>
  51. 'UI Task' (Managed): Loaded 'System.Runtime.Serialization.dll'
  52. SEND: <iq id="MX_3" type="get" to="conference.jabber.org" xmlns="jabber:client">
  53.  <query xmlns="http://jabber.org/protocol/disco#items" />
  54. </iq>
  55. REC: <iq from="jabber.org" type="result" id="MX_2" xmlns="jabber:client" />
  56. SEND: <iq id="MX_4" type="get" xmlns="jabber:client">
  57.  <query xmlns="jabber:iq:roster" />
  58. </iq>
A first chance exception of type '_?' occurred in Matrix.dll
OnClose
This post was edited 2 times, last on 2014-07-30, 17:53 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
sorry, but without a full stacktrace I am unable to help.
You send your disco request also very early. Please try to send it later when you complete session is ready.

Alex
Avatar
roseline2 #5
Member since May 2012 · 8 posts
Group memberships: Members
Show profile · Link to this post
You are right, at least now it works a little better. I added  System.Threading.Thread.Sleep() in OnNavigatedTo(NavigationEventArgs e) but it often crashes maybe because there are a lot of rooms.
I added System.Diagnostics.StackTrace() before calling Disco#Items and i got:


at Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)
at System.Windows.Navigation.NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, PhoneApplicationPage existingContentPage, PhoneApplicationPage newContentPage)
at System.Windows.Navigation.NavigationService.CompleteNavigation(DependencyObject content, NavigationMode mode)
at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)
at System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCalSEND: <iq id="MX_3" type="get" to="conference.jabber.org" xmlns="jabber:client">

Does it help you?
Avatar
Alex #6
Member since Feb 2003 · 4447 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by roseline2:
Does it help you?

no not really. But it looks to me like its a threading problem in your app and not related to MatriX. Please study multi threading in Windows Phone and especially how to update the UI in a thread safe way. MatriX is running in other threads than your GUI thread. And if you don't set an invoke control in MatriX all events not invoked to your UI thread.

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: