Trying to set the active Lync Audio device to one of the available audio devices. Lync_Client.DeviceManager.AudioDevices.Count returns a number greater than 0 but statements like Lync_CLient.DeviceManager.AudioDevices[i] in a for loop from i = 0 to i < count or foreach (AudioDevice dev in Lync_Client.DeviceManager.AudioDevices) immediately raises an exception when run on Windows 10 PC - but not on Windows 7 PC. Windows 10 version produces an exception with the Message: "Exception has been thrown by the target of an invocation.
Any suggestions? Could this be a privilege issue?
Below is the StackTrace:
...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 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()
The stack from here on out points to my code that attempts to access the Lync AudioDevices elements enumeration