commandline: IOException when ParserSettings loaded in WPF App

When i use the Library in my WPF App (not Console App), there will be thrown an IOException in the Constructor of ParserSettings. It will be catched and DefaultMaximumHeight will be set. But it would, in my opinion, cleaner with that code:


            try
            {
                if (Console.IsOutputRedirected || Console.WindowWidth < 1)
                {
                    maximumDisplayWidth = DefaultMaximumLength;
                }
                else
                {
                    maximumDisplayWidth = Console.WindowWidth;
                }
            }
            catch (IOException)
            {
                maximumDisplayWidth = DefaultMaximumLength;
            }

If you agree, i could do a pull request and merge it.

Best regards Lord_Pinhead

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 17

Commits related to this issue

Most upvoted comments

The exception is handled by try ..catch and is not fired at Release Configuration. It’s caught and swallowed by setting Console.WindowWidth=80 when redirected in WPF. In debugging, you can configure the debugger to ignore breaking on the First Chance Exception of IOException and it will ignore it (because it’s handled and not re-thrown again) using Debug > Windows > Exception Settings.

This issue will be fixed in the next release.