Exception unloading Xaudio2_7 on windows 8 #532
Comments
Does it unload itself when there are active voices playing? I am on Windows 8 too but have had no problems with SharpDX's XAudio2. I think underneath they are both (Win7 and Win8) accessing the same DirectX library in one of the windows system folders. |
It actually seems to crash regardless of playing any sound. I am getting it to happen 15ish minutes after just initializing the XAudio2 device and starting the engine, no sound playing or buffers being populated or anything. It seems like such a simple use case that I would expect it to be a problem on my end with my deployment. Is there anything fancy you have to do when creating your installer using the SharpDX DLLs on Wind 8 vs Win 7? Are the underlying XAudio2 DLLs included in the NuGet for SharpDX XAudio2? I have tried using the SharpDX DLL every minute or so, in an attempt to keep the DLL active and not unload (I was actually checking the attached devices once per minute), but that didn't seem to have any effect. Might there be an alternative way to keep the DLL from unloading? |
@wun23 What is exactly your code? Could you provide a simple Program.cs that replicate this problem? |
Sure, as soon as I get a chance I will pull out our XAudio2 code into its own program and send it your way. |
@wun23, most probably you haven't disposed some unmanaged resources - so the app crashes while trying to access objects whose unmanaged resources were unloaded with the DLL. Keep in mind that there can be some asynchronous processing - try to check if all buffers are cleared/flushed and just for the sake of experiment - insert a delay before unloading the DLL (don't do this in production!). |
Sorry for the delay, been pretty busy here recently. I am currently working on creating a barebones prototype that displays this behavior. If I am unable to do so, then we are doing something inappropriate with the drivers and I will update this thread accordingly. @ArtiomCiumac - We are not currently unloading the assembly by hand, so I can't really do any delays during an unload. I assume DLL unloading is done by Windows as it sees fit for an application, but strangely enough it is unloading the DLL even while being used once per minute. |
Update: we are having trouble steadily reproducing this in a barebones app, but have a quick question for you. It appears our Windows 8 machines which exhibit this behavior are using XAudio2_7.dll (hense the XAudio2_7.dll unload error) while I see that Microsoft has released an XAudio2_8.dll with some changes to some driver setup code. Should Windows 8 machines target XAudio2_8 exclusively, or should they be fully compatible with XAudio2_7? If the answer is that Windows 8 machines should be targeting the 2_8 DLL, how do we coerce SharpDX into targetting that specific dll? |
I am receiving an Access Violation Exception (0xc0000005) when running my app for 10-15 minutes on Windows 8 (dump below) during a DLL unload (done automatically, not by me). The code runs just fine for hours on end with Windows 7. My app is not running any sound, but apparently loading in the DLL's during start up and crashing 10-15 minutes later:
Faulting application name: MyApp.vshost.exe, version: 12.0.30723.0, time stamp: 0x53cf4fe5
Faulting module name: XAudio2_7.dll_unloaded, version: 9.29.1962.0, time stamp: 0x4c0643cc
Exception code: 0xc0000005
Fault offset: 0x0000000000032891
Faulting process id: 0x57c8
Faulting application start time: 0x01d02646b37ecb23
Faulting application path:
Faulting module path: XAudio2_7.dll
Report Id: 12015096-9242-11e4-8267-84c9b27dcf14
Faulting package full name:
Faulting package-relative application ID:
I'm currently using SharpDX version 2.6.3 off NuGet with Visual Studio. As mentioned, I have seen this on a couple Google searches, with no resolutions. Am I just mismatching the Windows 7 dll with Windows 8? Is there a different way of doing this on Windows 8? I've read the XAudio2 API docs on MSDN and I know it is handled differently, I assume the SharpDX is taking care of that portion. This may be some rudimentary mistake I am making, so feel free to redirect me to some documentation if applicable.
Get back to me when you get a chance, and thanks for your time,
-wun23
The text was updated successfully, but these errors were encountered: