Identify Parser failure

Aug 29, 2013 at 11:00 AM

Have used this library many times before and up to now have always found it pretty useful. However today, I have an app that has up to a dozen parameters and when I run it the code returns false on the line

if(Parser.Default.ParseArguments(args,options)) {...}

However there doesn't appear to be any easy way to identify which of the many parameters (or anything else) might be causing the failure? Any ideas?

Feb 5, 2014 at 5:09 PM
Hello sbarret,

I'm struggling with the same problem.

According to my understanding of the documentation, the following program whose could you find below should display help including a description of what went wrong if starting it with
ParserTest12313 fijg3e9o
ParserTest12313 --dasfgt3ij
All of the above calls don't trigger any output.

According to my understand, the following should trigger a display of the help screen:
ParserTest12313 --help
Again this triggers no output.

This should display My dummy string is Bla, and it does!
ParserTest12313 --dummy Bla
Here's the full code tested with 1.9.71:
using System;

using CommandLine;
using CommandLine.Text;

namespace ParserTest12313
    public static class Program
        class Options
            [Option("dummy", Required = true)]
            public string Dummy { get; set; }

            public string GetUsage()
                return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current));

        static void Main(string[] args)
            var parser = new Parser();
            var options = new Options();
            if (parser.ParseArguments(args, options))
                Console.WriteLine("My dummy string is {0}", options.Dummy);
Any ideas why it doesn't work as expected?

Many thanks!