Subject: Null exception in IqFilter.SendIq
The following code works on the desktop. It's purpose is to check if the user has been subscribed to a node more than once. If they have, all of those subscriptions are removed and a single new subscription is created. The code throws a null exception at the SendIQ call.
foreach (XElement element in subs.Elements(ps + "subscription"))
{
Iq iq2 = new Iq();
iq2.To = pubsubService;
iq2.From = UserJid;
iq2.Type = IqType.set;
string subid = element.Attribute("subid").Value;
Unsubscribe unsub = new Unsubscribe();
unsub.Node = editNode;
unsub.Jid = UserJid;
unsub.SetAttribute("subid", subid);
iq2.Query = new XElement(ps + "pubsub", unsub);
IqFilter myFilter = new IqFilter(_xmppClient);
***** myFilter.SendIq(iq2, MyUnscubscribeResult,null);
}
SendIQ xml
<iq to="pubsub.real" from="bob@real" type="set" xmlns="jabber:client">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<unsubscribe node="EditNode" jid="bob@real" subid="n1gbwYqLQyH4ILW71fVrk19MJATXnnqna0Wl0PpY" />
</pubsub>
</iq>
The SendIQ call does not result in an _xmppClient_OnError message the stack trace follows
Value can not be null.
Parameter name: key
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.Insert(String key, ? value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(String key, ? value)
at Matrix.IqFilter.SendIq(Iq iq, EventHandler`1 callback, Object state)
at RrISE.XMPP.CF.XmppManager.MyCheckForSubscriptionResult(Object sender, IqEventArgs e)
at Matrix.IqFilter.?(Object ?, IqEventArgs ?)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Windows.Forms.Control.TASK.Invoke()
at System.Windows.Forms.Control._InvokeAll()
at System.Windows.Forms.Control.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.ContainerControl.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
at Microsoft.AGL.Forms.EVL.EnterModalDialog(IntPtr hwnModal)
at System.Windows.Forms.Form.ShowDialog()
at
Thanks
foreach (XElement element in subs.Elements(ps + "subscription"))
{
Iq iq2 = new Iq();
iq2.To = pubsubService;
iq2.From = UserJid;
iq2.Type = IqType.set;
string subid = element.Attribute("subid").Value;
Unsubscribe unsub = new Unsubscribe();
unsub.Node = editNode;
unsub.Jid = UserJid;
unsub.SetAttribute("subid", subid);
iq2.Query = new XElement(ps + "pubsub", unsub);
IqFilter myFilter = new IqFilter(_xmppClient);
***** myFilter.SendIq(iq2, MyUnscubscribeResult,null);
}
SendIQ xml
<iq to="pubsub.real" from="bob@real" type="set" xmlns="jabber:client">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<unsubscribe node="EditNode" jid="bob@real" subid="n1gbwYqLQyH4ILW71fVrk19MJATXnnqna0Wl0PpY" />
</pubsub>
</iq>
The SendIQ call does not result in an _xmppClient_OnError message the stack trace follows
Value can not be null.
Parameter name: key
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.Insert(String key, ? value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(String key, ? value)
at Matrix.IqFilter.SendIq(Iq iq, EventHandler`1 callback, Object state)
at RrISE.XMPP.CF.XmppManager.MyCheckForSubscriptionResult(Object sender, IqEventArgs e)
at Matrix.IqFilter.?(Object ?, IqEventArgs ?)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess, StackCrawlMark& stackMark)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Windows.Forms.Control.TASK.Invoke()
at System.Windows.Forms.Control._InvokeAll()
at System.Windows.Forms.Control.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.ContainerControl.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
at Microsoft.AGL.Forms.EVL.EnterModalDialog(IntPtr hwnModal)
at System.Windows.Forms.Form.ShowDialog()
at
Thanks
This post was edited on 2010-06-08, 17:20 by Beaker.