MGCB.exe command failing during compile

Hello, fairly far along with development of my game (we’re on Greenlight now!) and I’ve run into a pretty strange and alarming problem now.

I am able to open and build the Content file just fine in the pipeline tool, but when I compile in VS2012, I’m getting the following error:

Error	1	The command ""C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"D:\dev\Bazaar\Bazaar\Content\Content.mgcb" /platform:Windows /outputDir:"D:\dev\Bazaar\Bazaar\Content\bin\Windows" /intermediateDir:"D:\dev\Bazaar\Bazaar\Content\obj\Windows" /quiet" exited with code -1073741819.	Bazaar

Searching around for others having this problem, I found Tom Spilman recommending to others to copy the command and manually run it in a command line. Running it manually succeeds for me. After running it, I am then able to pop back to VS2012 and compile/run the game just fine, but only once. If I compile in VS a second time, I start getting the error message again. If I pop back over to the command line and manually run the command again, I can then successfully build one more time in VS2012 before I get the error again.

The net effect is that I can still compile/run my game, but now I have to take the extra step of manually running the command each time I want to run the game once.

Would someone be able to help me figure out how to debug this issue? I try to be as self-sufficient as possible with problems like this, but this is really eluding me and it’s quite frustrating. Thanks in advance!!

I know this isn’t the solution you’re looking for, but you don’t need to run MGCB.exe when you compile and run the game. The reason it runs every time your solution runs is to automate the process of placing the .xnb files in the Debug/Content folder, but you can take .xnbs you’ve generated from entirely different projects that aren’t associated with your project at all, and just drag and drop them into Debug/Content and the game will run fine, if the build process has been detached from MGCB.exe. I don’t actually know how one would go about detaching MGCB.exe so that it doesn’t run every time you run the solution, but if you could, that would spare you the step of having to open a command prompt every time you want to debug your solution. It does mean that you would have to manually drag and drop the .xnb files to the Debug/Content folder, though, but unless you’re frequently generating new .xnbs, that will probably be less of a hassle than what you’ve described.

I’d probably wait for someone to come along and give you a better answer, though.

Thanks for the reply. The frustrating part for me is that the MGCB command running each time is quite convenient, and that’s how it’s been working for the many months that we’ve been working on this game. So for it to suddenly stop working this late in the process (when most of the coding is done and we’re now just filling the game with content, levels, etc.) is an issue, since this is when we need it to be automated the most.

Rather than try to find a way to disconnect the broken part of the process, I’d like to know how to get things running the way they were. My workflow up until now has felt very streamlined; I enjoyed how rapidly I could make changes and test them.

Googling the error code the command is throwing (-1073741819) suggests it’s some kind of File System error. However, I’m still unsure why I’d be able to run the command manually in a command prompt with success, and also why it only solves the problem long enough to do exactly 1 compile within VS. This seems like a really unusual error to me.

Maybe it would be worth it to just uninstall Monogame and reinstall from scratch?

It does seem weird. Are you using VS2012 because you own the Professional edition? If your team isn’t composed of more than five people, I’d say try using VS Community 2015 as well as reinstalling Monogame. Unfortunately, I can’t guarantee that either of those actions will fix the problem…

I do have a license for the Pro edition, so that’s one reason I’m using it, but the bigger reason is just because I’m very comfortable with the IDE at this point, having memorized all the common shortcuts and having the options/extensions configured the way I like it, etc. I also am not totally comfortable with the idea of introducing that kind of instability (changing IDEs) right at the very end of a project. I was planning on waiting till after this project is completed and upgrading to 2015 before starting our next one.

However, I would still be willing to try it if nothing else works! This problem is not crippling at the moment, but it’s annoying enough that it’s distracting me from getting my work done. I’m so used to making a change and hitting F5 to run immediately that it’s really jarring when I get this error each time. It would be so nice to get it fixed and get back to work.

I’ll give this thread some more time to get some other opinions and if all else fails I’ll try upgrading. Thanks again for the replies!

Update: I tried uninstalling Monogame and installing again, but the problem is still occurring.

Any help would be greatly appreciated!

Can you think of anything that changed around the time the problem showed up? Something had to have changed, since you said it worked before. The problem will be tracking down what changed.

I recently ran into problems with the content pipeline, and using version 3.4’s pipeline as opposed to the one from the latest development build fixed it, strangely.

I’m glad you asked about this, because I didn’t think to include that info. It seems that the problem started occurring when I reinstalled Monogame a few days ago to try solving an unrelated issue.

Something was making my VS2012 slow to a crawl, so I tried installing VS2015, and reinstalled Monogame with the 2015 templates. When I tried running the game in VS2015, I was getting errors. At that point I decided that getting it running in 2015 was going to be a hassle and I didn’t want to deal with the added instability to the project, so I decided to uninstall 2015 and went back to 2012.

At that point I was able to find and fix the slowness issue (it was one of the extensions I was using), but now I was getting the error as described in this thread which has not gone away.

To summarize, here are the recent changes to my system:
-Installed VS2015
-Installed Monogame VS2015 templates
-Uninstalled VS2015

I wonder if going back to an older (or newer) version of Monogame would help.

Definitely try going back to 3.4, or one of the earlier ones if that was what you were using.
Then, when 3.5 is released, I would try making a build of the game that uses that, since some pretty important bugs have been caught since 3.4, like this one.

I was using 3.4, I’m excited to see what 3.5 brings when it’s released. I was hoping they’d be able to stick to their monthly releases as previously suggested, but I know it’s unfair to set expectations too high when they’re not even charging me for the product!

I decided with how many reinstalls and tweaks I’ve been making that it would be better to just uninstall all residual components of Monogame, XNA and Visual Studio on my computer and do a fresh install of only the things I need. I have remnants of so many versions of everything from over the years that it will be nice to start over either way. Will report back when everything is done.

Thanks for the continued suggestions, it would be pretty lonely in here without you :smile:

Finally finished cleaning everything up, installed VS2012 from scratch, installed the latest service pack, and then installed Monogame with just the VS2012 templates. Unfortunately this did not fix the problem.

I was wondering if this could possibly be some kind of permissions issue. I’m not extremely adept at troubleshooting issues like that, so this may not have been a logical step to take, but I tried changing the MGCB.exe executable properties to always run as administrator and I think I noticed something interesting. Now when I run the VS build, it automatically opens a command prompt, and I can see all of the MGCB output flying by as the content build is run. When the build is successful, nothing of interest pops up, but when I run the build a second time and get the failure (as described in the OP of this thread), an error quickly flashes by before the command prompt closes and the VS build reports that it failed.

I managed to snag a screenshot of the error before it closed and it looks quite interesting:

Assuming this is related to my original problem (and not just a result of running MGCB.exe as administrator), it’s good to at least have an error message to use to start debugging, although I’m still not sure where to go from here.

It’s important to note that the build still works fine on my colleague’s computer, and that .png (which is used as a font texture) hasn’t changed in 3 months.

Yeah, unfortunately, this board isn’t exactly thriving. But I do my best to help people who have questions whenever I can, though more often than not I have no idea how to answer questions, since my knowledge of the inner workings of Monogame is pretty limited.

A pity that the reinstall didn’t fix the problem. That error report is interesting, though. I was able to replicate the behavior you described using the MGCB.exe I had problems with, only my message output was different:

Knowing what exception is being thrown should help. One possibility might be to build Monogame from source so that you can locate the offending line and determine what might be causing the exception.

Interesting, I’ve actually had problems with the FreeImageAPI area of Monogame in the past, I wonder if there’s something buggy at the core of the MG code using it.

I’ll try a few different versions of Monogame as you suggested, forgot to try that earlier. I’d like to avoid delving into the Monogame source if possible because that would be a pretty serious diversion, but I’ll keep it in mind as a last resort if needed.

And it’s cool that you try to help people here, I’ve definitely had problems getting responses here in the past. This is my third threat on these boards but the first one that’s gotten any replies :stuck_out_tongue_closed_eyes:

Wow, downloaded the latest development build of Monogame (3.5.0.629) and the error went away! I guess this mystery will be left unsolved, but I’m happy to leave it behind. Whatever it is, the Monogame fellas must have fixed it.

Thanks for helping me think this through AJP, really appreciate your help!

If there’s anyone else out there having issues hopefully they’ll find this thread and it will help them too.

No problem, glad the issue went away. Good luck with your game!

I’ve just encountered this issue when MonoGame 3.6 was installed on a school network with Visual Studio 2013 (Professional) on WIndows 8.1. My network manager managed to solve it quite quickly.

The problem was that MGCB was running from the current user’s temp folder (C:\users\username\local\temp), and that folder had set permissions to deny running executables for security reasons. We couldn’t find a way to change this path, but did manage to create a rule that allows this program to run in the temp folder.

As a possible solution, make sure that you have full permissions for the temp folder, of, if you know a way, change where MGCB runs from.