Commandline: TimeSpan option failing to parse with "bad format"

Created on 4 Nov 2017  路  3Comments  路  Source: commandlineparser/commandline

Issue by georgiosd
_Monday Oct 16, 2017 at 07:30 GMT_
_Originally opened as https://github.com/gsscoder/commandline/issues/493_


If defined a TimeSpan? property in my options and passed it as "00:30" from the commandline but it failed with "bad format".

Is this not supported?

Most helpful comment

Comment by SuperJMN
_Sunday Oct 22, 2017 at 16:31 GMT_


I'm having the same problem with a nullable enum.

All 3 comments

Comment by SuperJMN
_Sunday Oct 22, 2017 at 16:31 GMT_


I'm having the same problem with a nullable enum.

I'm having the same problem with a nullable enum.

Same here.

I think this is the root of the problem: https://weblogs.asp.net/pjohnson/Convert.ChangeType-doesn_2700_t-handle-nullables

Convert is not very extensible and was designed around a fixed set of types

The library uses Convert.ChangeType internally to convert from string which doesn't support nullable at all. We need to gut it and add support for ComponentModel/TypeConverter, which would also let developers add converters for custom types.

Was this page helpful?
0 / 5 - 0 ratings