AudioSwitcher: "System.NullReferenceException" in AudioSwitcher.AudioApi.CoreAudio.dll
I’m using VS2017 on Windows 10. My WPF application is using the lastest version of this API and has a Realtek onboard sound card
I want to set the volume of the windows setting to max like that:
CoreAudioDevice defaultCaptureDevice = new CoreAudioController().DefaultCaptureDevice;
defaultCaptureDevice.Volume = 100;
So far it’s working but after the first call my CPU usage is increasing and I constantely receive this message in the VS2017 output window:
“System.NullReferenceException” in AudioSwitcher.AudioApi.CoreAudio.dll “System.NullReferenceException” in AudioSwitcher.AudioApi.CoreAudio.dll “System.NullReferenceException” in AudioSwitcher.AudioApi.CoreAudio.dll “System.NullReferenceException” in AudioSwitcher.AudioApi.CoreAudio.dll “System.NullReferenceException” in AudioSwitcher.AudioApi.CoreAudio.dll “System.NullReferenceException” in AudioSwitcher.AudioApi.CoreAudio.dll …
It’s not stopping. What is wrong?
I’m using AudioSwitcher.AudioApi.CoreAudio. 3.0.0.1 And I have to problem with Win 7 and Win 10
My WPF application has as target framework .NET 4.5.2
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 22 (7 by maintainers)
I just debugged the error as I too have multiple ArgumentNullExceptions on startup, with the pre-release version.
The error thrown is in the CoreAudioDevice.Internal.cs Line 115 _audioMeterInformationPtr = Marshal.GetIUnknownForObject(result); System.ArgumentNullException: ‘Value cannot be null. Parameter name: o’
System.ArgumentNullException HResult=0x80004003 Message=Value cannot be null. Parameter name: o Source=mscorlib StackTrace: at System.Runtime.InteropServices.Marshal.GetIUnknownForObjectNative(Object o, Boolean onlyInContext) at AudioSwitcher.AudioApi.CoreAudio.CoreAudioDevice.LoadAudioMeterInformation() in C:\Users\morga\Downloads\AudioSwitcher-master\AudioSwitcher.AudioApi.CoreAudio\CoreAudioDevice.Internal.cs:line 115
Hi Guys,
All of a sudden today I starting getting this issue when building new binaries. My binaries built from the exact same commit prior to encountering this problem work fine. Has anyone figured out what is causing the issue?