App works fine in Debug build; MainComponent window never shows up in Release build


I have a standalone GUI application created with JUCE v5.3.2 that I’ve been building and testing in Debug mode in MS Visual Studio 2017. I’ve been working with it for over a month now. I have no exceptions or other problems occur during the launch of the application when I am in Debug mode.

I have switched to a Release build as of today, after completing and debugging the application to my satisfaction. Oddly enough, the application launches and carries out all of the commands in the MainComponent constructor, then immediately disappears without an error. I know that it carries out all of its commands because it writes out a handful of text files and a couple of binary files at the end of the constructor, and those files are present on the hard drive and contain everything I would expect them to.

When I watch Task Manager (Windows 10) I can see that my application begins as a background process, then gets recategorized as an app while it carries out the instructions that create the files, it then briefly reverts to a background process before closing itself out entirely. I never see the actual component GUI appear on screen, though I do see a file chooser that pops up prompting for the location of the working directory (where the log files go), which is something that takes place at the beginning of the MainComponent constructor.

So far I’m at a loss. I’m not sure how to troubleshoot this. I’m hoping someone can point me in the right direction here. The application has thousands of lines of code, so it’s not practical for me to post a code example.

RECAP: Application carries out all constructor code and shows MainComponent GUI when run from a Debug build. Also, the MainComponent and all sub components behave as expected. I’ve yet to encounter an exception during a full week of QA testing. Switching over to Release build, I get an EXE that launches “invisibly” and carries out all constructor code, producing some external files, but never displays the GUI. Task Manager shows the application launch and then quit out automatically. No errors on screen.

Any suggestions on how to proceed with troubleshooting (e.g. what parts of JUCE component code, or Visual Studio settings, or combination thereof, most likely to cause this sort of behavior) would be greatly appreciated!


Whenever I have release only bugs, I tend to comment out large chunks of processing code until it finally runs, then go back smaller and smaller chunks if you can, to narrow in on the problem, which also nudges your brain towards the problem area. Kind of like binary subdivision for coding, if that makes any sense?


Make sure you have all your variables initialized. In a Debug build you can get away without initializing your variables since the debugger does that for you.



Ugh, yeah I seen that so many times, I think it all that training in C# land that does it.


@Rail_Jon_Rogut was right on the money. I had a vector of doubles that was somehow getting accessed before it had been populated. Apparently the Debug build was filling the vector with default values as needed to prevent an access violation.

Thanks to both of you for your helpful hints and rapid reply to the initial post!