Help! - SharpDX Exception when trying to Load Song under Win7 x86 ...

Sorry if this post might be in the wrong place… I’m a total newbie and played around a bit with Monogame 3.5 / Visual Studio 2013 for Desktop. I tried to play background music like this:

this.song = Content.Load(“Audio/MySong”);
MediaPlayer.Play(song);

I added the audio file (.MP3) to the Content Pipeline, compiled, .WMA and .XNB files are correctly created. Compile target is x86.

Under Win7 x64 (64bit), this works and the song plays. However, when I run the compiled program under my Win7 x86 (32bit) I get a SharpDX Exception. A Try/Catch of game.Run(); gave the following output:


SharpDX.SharpDXException: HRESULT: [0xC00D36C3], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: Unknown

at SharpDX.Result.CheckError()

at SharpDX.MediaFoundation.SourceResolver.CreateObjectFromURL(String wszURLRef, Int32 dwFlags, ComObject propsRef, ObjectType& objectTypeRef, ComObject& objectOut)

at Microsoft.Xna.Framework.Media.Song.PlatformInitialize(String fileName)

at Microsoft.Xna.Framework.Media.Song…ctor(String fileName)

at Microsoft.Xna.Framework.Media.Song…ctor(String fileName, Int32 durationMS)

at Microsoft.Xna.Framework.Content.SongReader.Read(ContentReader input, Song existingInstance)

at Microsoft.Xna.Framework.Content.ContentTypeReader`1.Read(ContentReader input, Object existingInstance)

at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject[T](T existingInstance)

at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T](T existingInstance)

at Microsoft.Xna.Framework.Content.ContentReader.ReadObjectT

at Microsoft.Xna.Framework.Content.ContentReader.ReadAssetT

at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)

at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)

at Demo.Game1.LoadContent() in c:\Program Files (x86)\Microsoft Visual Studio 12.0\Projects\Demo4\Demo\Game1.cs:Zeile 495.

at Microsoft.Xna.Framework.Game.Initialize()

at Demo.Game1.Initialize() in c:\Program Files (x86)\Microsoft Visual Studio 12.0\Projects\Demo4\Demo\Game1.cs:Zeile 379.

at Microsoft.Xna.Framework.Game.DoInitialize()

at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)

at Microsoft.Xna.Framework.Game.Run()

at Demo.Program.Main() in c:\Program Files (x86)\Microsoft Visual Studio 12.0\Projects\Demo4\Demo\Program.cs:Zeile 21.


I searched for HOURS, but couldn’t find a solution…

Any help?

I may be wrong, i’ve never tested a x86 project with monogame, but Monogame IS x64 (I Mean only x64).

What does the line 495 contain ?

at Demo.Game1.LoadContent() in c:\Program Files (x86)\Microsoft Visual Studio 12.0\Projects\Demo4\Demo\Game1.cs:Zeile 495

Line 495 contains

this.song = Content.Load(“Audio/MySong”);

It’s most likely not a bug in the code; I already wrote that the Content Pipeline creates the files and the song file plays correctly under Win7 x64…

As far as I know, MonoGame projects only COMPILE under Win7 x64 (due to the Content Pipeline not supporting x86 anymore), but you can still TARGET x86 systems?

Is there anything Win7 x64 has that Win7 x86 does not, but is needed to process song loading?

Anyone who could test on their own machine, to check if it’s just me or a problem in general?

The content pipeline is 64-bit only. Executables built to use MonoGame are not limited to just 64-bit.

@Absolute_Beginner

Your development environment must be x64 (you must be using visual studio/monogame on x64 version of windows) to build/compile. You can then run the executable build on an x86 machine.

(that right Konaju?)

Sorry, that was not the question.

I already said that I compile under Win7 x64, and there the background music loading/playing works. The error happens when I test the compiled program on my Win7 x86 machine.

So, the compiled app must be AnyCPU or x86, right ?
Correct me if i’m wrong, a x64 only app can not be run under x86 OS.

So you build it and take it to a x86 machine and try to run?

Yes, I build it with target x86, and it runs and plays the background music correctly under Win7 x64, but when I test the compiled program under Win7 x86, I get the SharpDX Exception (already explained it, see messages above) :confused:

Has the machine got DirectX installed and .Net framework?

sigh … yes, and everything else (loading and displaying images, scaling, getting keyboard & mouse input etc., even sound effects) also work on the Win7 x86 machine. Just the background music doesn’t.

If you can point me to anything that might be missing on the x86 machine which could produce such an error, or if you could test it on another x86 machine (just try to load a background song) it would really be helpful.

Apart from that, I REALLY did all the obvious things and guessed around already… I need someone who KNOWS internal stuff about SharpDX…

Have you stepped through the code and made sure the song is not null?

Thanks, but IT PLAYS PERFECTLY when the compiled program is executed under Win7 x64 !!

Besides, wouldn’t I then get a null reference exception?

The callstack in your first message shows it was trying to load the WMA, but it failed for some reason. Are you sure the files (XNB and WMA) are in the right place in the Content folder on the 32-bit machine?

Are you doing a release or debug build?

As Konaju says, check the folder structure, depending on setup you may have like:

bin/x86
bin/debug/x86

you may be copying the non debug folder or vice versa and it doesn’t have all the compiled files.

Or perhaps its just a pathing issue, is your content folder definitely there on the x86 machine and in the same spot?

I copied the compiled program with all its sub-folders to an entirely different folder, and there it runs perfectly under Win7 x64 but crashes under Win7 x86. And yes, I tried both debug and release builds.

Besides, the error doesn’t look like a ‘file not found’ exception.

Is the Win7 x86 a fresh install?
I think MG/DX has a dependency on DX9 for sound.
Install DX9.0c and see if it works…

DxDiag shows me Win7 Home Premium N with DirectX Version 11 and lists no problems/errors.

Has nobody here any deeper knowledge about SharpGX, and what exactly it needs / does when playing a background song?

Make sure 9c is installed, having 11 does not mean you have 9.

https://www.microsoft.com/en-gb/download/details.aspx?id=34429

https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=35

Ok, downloaded the DirectX Web Setup, started it, it installed nothing, so I guess I’m up-to-date.

Nothing has changed.