Content.Load<Texture2D> gives NullReferenceException

I recently started work on rewriting my game so I could clean up the codebase and stuff. When I got around to writing in the code for loading in content it always crashes with the error "System.NullReferenceException: Object reference not set to an instance of an object
-recompiling and reloading my content mgcb file into the game
-configuring the build settings for the mgcb to be the same as what they were in my old codebase (which, while I’m on the topic, had almost identical LoadContent code, so it’s almost certainly not that)
-checking the directories and names of the files
Probably some more small stuff that I’m forgetting too, lol. Any ideas on what’s going on? I’ve spent quite a few hours now and have been unable to resolve the issue using any solutions I’ve found online so far.


Did you set a breakpoint to see if there’s anything obviously null?

It’s a long shot, but when I first started with MG I saw an error just like that when I forgot to set the MonoGame.Framework.Portable reference to have <PrivateAssets>all</PrivateAssets> in my shared library. Without it, the Portable binaries were being copied to the output instead of the platform binaries, so Content (among most other things) was null since there was no implementation.

I ended up rewriting the whole thing from scratch, just in case there was some stupid 1 character mistake that I missed somewhere, or weird thing I forgot that I couldn’t catch, and it ended up working, lol. Thanks for the help though.