[Solved] Content.Load<Song> causing exception, looking in wrong path

Hello,

I hope this post is okay. I have done a search and not managed to find anything so please, close or ignore this if I’m just being a dumbass.

I’ve successfully loaded images and shaders using the Content Manager using MonoGame 3.6. I have tried with an audio file and its causing an exception.

In a nutshell, the load function for “Song” is looking in the root of my drive for the sound file, instead of root of the “Content” directory. I’ve attached an image :

As you can see, its built fine, its in the root of the Content folder like the image and fx files. I call it by its name with the extention omitted.

Edit: “Build Action” is set to “Build” and if I put the .ogg in the root of the drive, it plays no problems.

So, have I setup something wrong or is this unexpected behaviour? Any insight/help is really appreciated.

Incase its needed I’m using Visual Studio 2015 Update 3 on Windows 7 x64

(And I fixed the local declaration of mSong, it has no bearing on this issue)

No idea what’s going on here, but that’s definitely a bug. I don’t think this code was touched in develop since the 3.6 release, so it probably won’t be any better with the develop branch.

Could you open an issue on GitHub for this with the same info you’ve provided here? Issues · MonoGame/MonoGame · GitHub

This forum is pretty loose, no need to worry about that stuff :smiley: You can shitpost all you want, as long as it’s MG related :stuck_out_tongue:

Have you defined .RootDirectory? show that code…

Okay, I’ll head over there and see what they say.
And thanks, that’s good to know :smile:

This is the constructor of the class that inherits from the “Game” class. That is the default value given when making the project from the cross-platform template.

In the first image it shows that same value on line 74 and in the autos window at the bottom. The shader and image files are found no problems, also it doesn’t look in "S:" for them.

Hmm, can you move the project to C:\ and see if the issue persists…

1 Like

It worked no problems. No exception, didn’t change any code. Is that still a bug? Surely the drive shouldn’t matter if the path is correctly retrieved?

2 Likes

Good idea @MrValentine :slight_smile:

Yeah, this is surely a bug.

1 Like

Here is a link to the issue on Github: https://github.com/MonoGame/MonoGame/issues/6075

1 Like

The issue appears to have been a ‘#’ character in a parent folder name of the project.

2 Likes

Yeah I see it now in his first image, I always type CSharp, never the symbol…

But how come it doesn’t occur on C:?

It probably does, its just that when you suggested that, I simply dumped the project folder on C:\ meaning the path was “C:\Project” not “C:\c# projects\Project”.

I can verify this when I get back home.

Edit: Checked and I get the same issue. It is an issue to do with the ‘#’ character in the path when loading Song files.

1 Like