本文介绍了无法从另一个线程调用UccContext.AddNamedProperty的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 当我尝试从另一个线程访问UccContext类的AddNamedProperty时,我得到"尝试读取/写入受保护的内存"。错误。以下代码段显示了将参与者添加到"pSession"的示例。我们之前创建的。 我的需求不仅限于在代码段中添加参与者,还包括发布在线状态,执行即时消息和与语音相关的操作。 代码段:              //使用传递的SIP uri $创建会话参与者b $ b UccUriManager uriManager = new UccUriManager(); UccUri u = uriManager.ParseUri(con​​tactURI); // UccContext ctx = new UccContext(); //ctx.AddNamedProperty("User" ;, u.User); IUccSessionParticipant p = pSession.CreateParticipant(uriManager.ParseUri(con​​tactURI),null); UccOperationContext operationContext = new UccOperationContext(); UccContext pContext = new UccContext(); // pContext.AddNamedProperty(" OpCaller"," session.AddParticipant"); operationContext.Initialize(1,null); pSession.AddParticipant(p,operationContext); 上面的代码在主线程中使用时效果很好,但是当从另一个线程使用时它会出错。 提前致谢。 Annie 解决方案 Hi Everyone,When I try to access AddNamedProperty of UccContext class from another thread, I am getting "Attempted to read/write protected memory" error. Following code snippet shows the example of adding a participant to the "pSession" which we have created before. My need is not just limited to adding participants as provided in the code snippet but also to publish presence, perform IM and Voice related operations.Code Snippet:             //create a session participant using the passed SIP uri UccUriManager uriManager = new UccUriManager(); UccUri u = uriManager.ParseUri(contactURI); //UccContext ctx = new UccContext(); //ctx.AddNamedProperty("User", u.User); IUccSessionParticipant p = pSession.CreateParticipant(uriManager.ParseUri(contactURI), null); UccOperationContext operationContext = new UccOperationContext(); UccContext pContext = new UccContext(); // pContext.AddNamedProperty("OpCaller", "session.AddParticipant"); operationContext.Initialize(1, null); pSession.AddParticipant(p, operationContext);The above code works perfectly fine when used in the main thread but it gives the error when used from another thread.Kindly provide me with the solution to this problem.Thanks in advance.Annie 解决方案 这篇关于无法从另一个线程调用UccContext.AddNamedProperty的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 08:37