xenolightning / AudioSwitcher

.NET Library which facilitates interacting with Audio Devices on Windows
Microsoft Public License
248 stars 53 forks source link

Known Issue: Audio Sessions - "Random" exceptions #34

Open xenolightning opened 7 years ago

xenolightning commented 7 years ago

There is an issue in the session create code which causes either COM Objects to be access in a non thread safe manner, or the lifecycle is disposed prematurely.

The session controller should probably not be a DeviceCapability it causes oddities.

barneywilliams commented 7 years ago

I am wondering if the exception we are seeing is related to what you have seen:

Exception thrown at 0x0CBD288A in MyApplication.exe: 0xC0000005: Access violation reading location 0x00000000.
The Common Language Runtime cannot stop at this exception. Common causes include: incorrect COM interop marshalling and memory corruption. To investigate further use native-only debugging.
Exception thrown: 'System.NullReferenceException' in AudioSwitcher.AudioApi.CoreAudio.dll

We end up getting these 3 messages in the debugger over and over.

Thanks a ton for putting this project together! Any help would be much appreciated.

xenolightning commented 7 years ago

Yeah, it looks to be the same if not related to: https://github.com/xenolightning/AudioSwitcher/issues/31

It's fairly hard to track down exactly what is causing it. Only that it's somewhere in the session creation/initialization.

Are you using sessions in your app?