[PROBLEM] Content.get return null

Hey,

Just look the screen.

Error: Microsoft.Xna.Framework.Game.Content.get return null.

Edit: It appeared when i installed Nuget package MonoGame.Extended and MonoGame.Extended.Pipeline

Edit 2: Solved with unable ContentPipeline nuget package

What happens if you move that code to the start of Initialize?

Could you please explain a little more how you solved it?

This also happens to me when I install MonoGame.Extended.Content.Pipeline and I can’t manage to fix it.

Did you try Kimimaru’s suggestion? If I’m reading this right, it’s saying that ‘Game.Content.get’ is null, which means that the Content : ContentManager property in the Game class was never set. That sort of thing should normally happen during initialization of the game. If the Game class hasn’t finished initializing when this method is called, this error might be thrown as it hasn’t had a chance to set that property yet.

You could test this theory by just making a new ContentManager instance before trying to use ‘Content’.

this.Content = new ContentManager(Services, "yourDirectoryHere");

This may be an okay workaround.

I’m not sure if it’s the same issue, but this happened to me without MonoGame.Extended because the MonoGame.Framework.Portable binaries were overwriting the platform-specific ones in the build output, so there was no implementation when the game would run.

I fixed this by adding <PrivateAssets>all</PrivateAssets> to the MonoGame.Framework.Portable reference in my shared project.