SEHException when initialising audio
Pathoschild opened this issue · 13 comments
Some players intermittently get this error:
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at new[](UInt32 )
at Microsoft.Xna.Framework.Audio.UnsafeNativeMethods.AllocateArrayAndReadFile(String filename, Void** ppData, UInt32* pdwBufferSize)
at Microsoft.Xna.Framework.Audio.UnsafeNativeMethods.WaveBank.CreateHandle(UInt32 hEngine, String string, Int32 length, IntPtr& pCleanup)
at Microsoft.Xna.Framework.Audio.WaveBank..ctor(AudioEngine audioEngine, String nonStreamingWaveBankFilename)
at StardewValley.Game1.Initialize() in C:\Users\tomc\Documents\Visual Studio 2010\Projects\Stardew.XNA\Farmer\Farmer\Game1.cs:line 535
at StardewModdingAPI.Inheritance.SGame.Initialize() in D:\source\SMAPI\src\StardewModdingAPI\Inheritance\SGame.cs:line 301
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Microsoft.Xna.Framework.Game.Run()
at StardewModdingAPI.Program.StartGame() in D:\source\SMAPI\src\StardewModdingAPI\Program.cs:line 259
Investigate, and either fix or document the workaround.
As requested in #430 heres the Voicemeter site https://www.vb-audio.com/Voicemeeter/index.htm
edit: in terms of variously fixing it: XNA complete removal and reinstallation, even the steam provided one, didnt help yet, so aint gonna be XNAs fault this time; neither is discord or anything other; seems to be an playback device issue as related in #430 ; the moment voicemeter and Virtual Audiocable are disabled, mostly by deinstalling, Stardew is working. Its still interesting tho why its not working then tho.
@vaindil Thanks! It's not something I'd recommend due to the disadvantages, but it's a clue to look into.
@Dexruus Can you post your SMAPI log after the error happens? How much RAM does your computer have?
16 GBs of RAM, 64 Bits, so usable
Error log is still the same as in #430 :
[19:09:34 INFO SMAPI] SMAPI 2.4 with Stardew Valley 1.2.33 on Microsoft Windows 7 Professional
[19:09:34 DEBUG SMAPI] Mods go here: C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods
[19:09:34 TRACE SMAPI] Log started at 2018-01-28T18:09:34 UTC
[19:09:34 TRACE SMAPI] Overriding content manager...
[19:09:35 TRACE SMAPI] Starting game...
[19:09:41 ERROR SMAPI] The game failed unexpectedly: System.Runtime.InteropServices.SEHException (0x80004005): Eine externe Komponente hat eine Ausnahme ausgelöst.
bei new
bei Microsoft.Xna.Framework.Audio.UnsafeNativeMethods.AllocateArrayAndReadFile(String filename, Void** ppData, UInt32* pdwBufferSize)
bei Microsoft.Xna.Framework.Audio.UnsafeNativeMethods.WaveBank.CreateHandle(UInt32 hEngine, String string, Int32 length, IntPtr& pCleanup)
bei Microsoft.Xna.Framework.Audio.WaveBank..ctor(AudioEngine audioEngine, String nonStreamingWaveBankFilename)
bei StardewValley.Game1.Initialize()
bei Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
bei Microsoft.Xna.Framework.Game.Run()
bei StardewModdingAPI.Program.RunInteractively() in C:\source_Stardew\SMAPI\src\SMAPI\Program.cs:Zeile 226.
[19:09:41 INFO SMAPI] Game has ended. Press any key to exit.
@Dexruus Can you replace your Stardew Valley.exe
file with the attached one, and see if that fixes it? (Don't forget to back up the old one.)
Will try tomorrow evening, its already pretty late here; will edit this when i tried.
Known facts
- It's been reported with the vanilla game (see examples one and two), but happens more often with SMAPI installed.
- Only happens on Windows? (Not confirmed.)
- The error was less frequent after #265 (which changed the load order so mods are initialised after the game + audio).
- The stack trace shows minimal SMAPI involvement; it happens deep in XNA code.
- Some affected players see it intermittently (so they can restart to fix it), while others see it constantly until they take steps to fix it.
Reported fixes
Players have variously fixed it by...
- rebooting;
- closing open apps (especially browsers, Discord, and music);
- closing background apps (particularly dynamic wallpaper engines and antiviruses);
- removing more-music mods;
- reinstalling XNA Framework (discussion);
- making
Stardew Valley.exe
large address aware (discussion).
Known cases
user | OS | cause | links |
---|---|---|---|
@Dexruus | Windows 7 Professional | Voicemeeter app | report, log |
Possible fix here from reddit? There's a well-known program for toggling this, aptly named Large Address Aware. Something to try, at least.
I tried reinstalling the game/xna/updating audio drivers/etc and nothing seemed to help. The fix that worked for me was to edit "Stardew Valley.exe" to be large address aware. This can be accomplished with the editbin utility that comes with any version of Microsoft Visual Studio.
Running this makes the game large address aware (with the file paths changed to be whatever is correct on your computer):
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64>editbin /LARGEADDRESSAWARE "C:\GOG Games\Stardew Valley\Stardew Valley.exe"
After this fix I no longer get the crash on launch and am able to play the game. Hope this helps someone!
Ok whatever you did seems to work properly. Stardew is up and running better than ever. Can confirm as fixed. Curious now what it was tho; If you need any log files to recycle, let me know.
Stardew Valley is 32-bit, so normally it can only access 2GB of RAM. I marked Stardew Valley.exe
as large address aware, meaning it can access more of your available RAM. The game itself should be fine, but I'm not sure about XNA Framework. Let me know if you run into any problems; if not, I'll add that to the FAQs as a workaround. 🙂
This is a game limitation, so there's not much we can do about it. The workarounds are now documented on the wiki.
Another way to solve this - applying Large Address Aware to StardewModdingAPI.exe. Only this solves problem for me.
Turns out the vanilla game sets the 'large address aware' flag, so it's safe for SMAPI to do it too. I'll add that to the build on Windows.