【问题标题】:Unable to get available audio device from Lync 2013 sdk无法从 Lync 2013 sdk 获取可用的音频设备
【发布时间】:2013-10-23 18:32:48
【问题描述】:

当我尝试获取这样的可用音频设备列表时。

LyncClient client = LyncClient.GetClient();
foreach (Device dev in client.DeviceManager.AudioDevices)
{
      //Do something
}

我收到错误Exception has been thrown by the target of an invocation.

"Unable to cast COM object of type 'System.__ComObject' to interface type 
'Microsoft.Office.Uc.IAudioDevice2'. This operation failed because the QueryInterface 
call on the COM component for the interface with IID '{86B3E5FE-4635-4C1E-
A725-C80B71D04984}' failed due to the following error: No such interface supported 
(Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

这是堆栈跟踪

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
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 Microsoft.Lync.Model.Internal.UCWCache.CreateUCW(Object source, CCOMInfo ccomInfo)
at Microsoft.Lync.Model.Internal.UCWCache.GetITTargetNS(Object source)
at Microsoft.Lync.Model.Internal.UCEnumerator`2.get_Current()
at Microsoft.Lync.Model.Internal.UCEnumerator`2.System.Collections.Generic.IEnumerator<S>.get_Current()

以及内部异常堆栈跟踪

at Microsoft.Lync.Model.Device.AudioDevice.INTERNAL_Init(IAudioDevice initInterface)
at Microsoft.Lync.Model.Device.AudioDevice.INTERNAL_Init_Object(Object initInterface)

【问题讨论】:

标签: c# lync lync-client-sdk lync-2013


【解决方案1】:

您是否检查过 Lync 和您的 SDK 是否具有相同的版本号?

似乎有多个 Lync 2013 版本,它们的版本可能不同。

【讨论】:

    【解决方案2】:

    问题似乎出在代码的“//做某事”部分。

    我只是跟着他跑得很好。

     var Client = LyncClient.GetClient();
    
           foreach (var dev in Client.DeviceManager.AudioDevices)
           {               
               Console.WriteLine(dev.Name);
           }
    

    如果这不起作用,是否有可能出现堆栈跟踪?

    【讨论】:

    • 当尝试影响 dev 变量时,错误发生在 foreach 本身内。我添加了堆栈跟踪。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-09
    • 2013-11-30
    相关资源
    最近更新 更多