Fix unhandled exception when invalid target platform is provided in mgcb by JakeLegendXIII · Pull Request #8713 · MonoGame/MonoGame
added 2 commits
April 6, 2025 20:51CartBlanche pushed a commit that referenced this pull request
Jun 27, 2025…gcb (#8713) Fixes #8519 ### Description of Change The _System.IO.IOException: The handle is invalid._ error when using an Invalid Platform was coming from the ShowError method when it tries to get the Console BufferWidth. Setting a fallback value and handling the error so that the default bw is set, even if the console has been output redirected, makes the build at least fail gracefully. If there are other suggested lengths or preferences feel free to let me know and I can update it! Additionally, I did add some code to the output message that gets printed for enums and grabs the list of valid values if an incorrect value is provided. Since I was working on the CommandLineParser.cs files I did notice that they had the old reference link for Shawn's blog. So I did update those to point to the new locations instead of the 404s. Updated output (not all of the Options are shown for brevity): 
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters