Subject: marix library 1.5.2.4, user is not registering
em using this following code ... this code is giving an error message of cross thread and other this message application halt.
Model.Utility.xmppClient.Dispatcher = this.Dispatcher;
Model.Utility.xmppClient.OnRegisterInformation += new EventHandler<RegisterEventArgs>(xmppClient_OnRegisterInformation);
Model.Utility.xmppClient.OnRegisterError += new EventHandler<Matrix.Xmpp.Client.IqEventArgs>(xmppClient_OnRegisterError);
Model.Utility.SetLicense();
Model.Utility.xmppClient.Username = txtphone.Text;
Model.Utility.xmppClient.SetXmppDomain(Model.Utility.Domain);
Model.Utility.xmppClient.Password = "password";
Model.Utility.xmppClient.RegisterNewAccount = true;
Model.Utility.xmppClient.Open();
private void xmppClient_OnRegisterInformation(object sender, RegisterEventArgs e)
{
e.Register.RemoveAll<Data>();
e.Register.Username = Model.Utility.xmppClient.Username;
e.Register.Password = Model.Utility.xmppClient.Password;
}
private void xmppClient_OnRegister(object sender, EventArgs e)
{
// registration was successful
}
private void xmppClient_OnRegisterError(object sender, IqEventArgs e)
{
// registration failed.
Model.Utility.xmppClient.Close();
}
//====================================
stack trace
=======================
{System.UnauthorizedAccessException: Invalid cross-thread access.
at MS.Internal.XcpImports.CheckThread()
at MS.Internal.XcpImports.DispatcherTimer_Stop(DispatcherTimer timer)
at System.Windows.Threading.DispatcherTimer.Stop()
at Matrix.XmppStream.DestroyKeepAliveTimer()
at Matrix.XmppStream.Close()
at Matrix.XmppStream.#=qXGDjopseCfmlIP5_mm1VoQ==(Object #=qVi4zofNC9IJTEWIShRRs9Q==, ExceptionEventArgs #=q5Z3umlhq7Pk9XPrHYD2h3w==)
at Matrix.Net.BaseSocket.FireOnError(Exception ex)
at Matrix.Net.ClientSocket.#=qvHrMepci4h6v_irb5D9l7RO$I8MA$BYvfax8ZFxp5BM=.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Matrix.Xmpp.Client.XmppClient.#=qsJo1pDRARWdebyfRzcbMWNy0_lciMdmML58vM$jckXI=.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}
Model.Utility.xmppClient.Dispatcher = this.Dispatcher;
Model.Utility.xmppClient.OnRegisterInformation += new EventHandler<RegisterEventArgs>(xmppClient_OnRegisterInformation);
Model.Utility.xmppClient.OnRegisterError += new EventHandler<Matrix.Xmpp.Client.IqEventArgs>(xmppClient_OnRegisterError);
Model.Utility.SetLicense();
Model.Utility.xmppClient.Username = txtphone.Text;
Model.Utility.xmppClient.SetXmppDomain(Model.Utility.Domain);
Model.Utility.xmppClient.Password = "password";
Model.Utility.xmppClient.RegisterNewAccount = true;
Model.Utility.xmppClient.Open();
private void xmppClient_OnRegisterInformation(object sender, RegisterEventArgs e)
{
e.Register.RemoveAll<Data>();
e.Register.Username = Model.Utility.xmppClient.Username;
e.Register.Password = Model.Utility.xmppClient.Password;
}
private void xmppClient_OnRegister(object sender, EventArgs e)
{
// registration was successful
}
private void xmppClient_OnRegisterError(object sender, IqEventArgs e)
{
// registration failed.
Model.Utility.xmppClient.Close();
}
//====================================
stack trace
=======================
{System.UnauthorizedAccessException: Invalid cross-thread access.
at MS.Internal.XcpImports.CheckThread()
at MS.Internal.XcpImports.DispatcherTimer_Stop(DispatcherTimer timer)
at System.Windows.Threading.DispatcherTimer.Stop()
at Matrix.XmppStream.DestroyKeepAliveTimer()
at Matrix.XmppStream.Close()
at Matrix.XmppStream.#=qXGDjopseCfmlIP5_mm1VoQ==(Object #=qVi4zofNC9IJTEWIShRRs9Q==, ExceptionEventArgs #=q5Z3umlhq7Pk9XPrHYD2h3w==)
at Matrix.Net.BaseSocket.FireOnError(Exception ex)
at Matrix.Net.ClientSocket.#=qvHrMepci4h6v_irb5D9l7RO$I8MA$BYvfax8ZFxp5BM=.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Matrix.Xmpp.Client.XmppClient.#=qsJo1pDRARWdebyfRzcbMWNy0_lciMdmML58vM$jckXI=.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}