2017-04-06 43 views
-1

我必須添加一項功能,允許用戶從應用程序中修改系統卷。爲此,我已使用CoreAudioApi.dll作爲本網站其他問題中引用的內容。CoreAudioApi.dll在某些計算機上拋出COMException

例如How to programmatically set the system volume?

我已經加入到CoreAudioApi.dll

參考這工作我開發的計算機上正常,但是,當應用程序是別人的計算機上運行(如人測試它),我們得到以下例外:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in CoreAudioApi.dll 
A first chance exception of type 'Autofac.Core.DependencyResolutionException' occurred in Autofac.dll 
A first chance exception of type 'Autofac.Core.DependencyResolutionException' occurred in Autofac.dll 
A first chance exception of type 'Microsoft.Practices.ServiceLocation.ActivationException' occurred in Microsoft.Practices.ServiceLocation.dll 

兩臺PC都運行Windows 7,64位。

關於什麼可能會導致此問題的任何想法?它是否引用另一個dll或可能碰巧有另一個dll或其他用戶沒有?

編輯

只是來縮小究竟發生異常......

private readonly MMDeviceEnumerator _deviceEnumerator = new MMDeviceEnumerator(); 
private readonly MMDevice _playbackDevice; 

public SettingsViewModel() 
{ 
    // The exception occurs in the following line: 
    _playbackDevice = _deviceEnumerator.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia); 

調試器將嘗試(在情況下的信息是任何幫助)

+0

其他用戶是他們機器上的管理員嗎? – BugFinder

+0

@BugFinder - 我已經要求他們嘗試以管理員身份運行,並沒有區別。 – colmde

回答

0

至於進入ServiceLocatorImplBase.cs通常,我會花幾個小時看一些東西,發表一個問題,然後直接打我。

另一臺計算機的音頻硬件似乎取決於揚聲器或耳機插入之前,它甚至會啓用自己。他們不是。 (由於我們的應用程序還沒有添加聲音,他依靠視頻檢查音量調音臺來測試它。)當其他用戶插入耳機時,一切正常。

我可以通過禁用音頻硬件在我自己的PC上重現問題。看起來我只需要處理這個異常,並在這種情況下禁用UI控件。

相關問題