diff --git a/CommandLine.snk b/CommandLine.snk index 96087a73..6b0b6501 100644 Binary files a/CommandLine.snk and b/CommandLine.snk differ diff --git a/appveyor.yml b/appveyor.yml index c7979afb..e472f66c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ #version should be only changed with RELEASE eminent, see RELEASE.md -version: 2.4.{build} +version: 2.5.{build} image: Visual Studio 2017 diff --git a/src/CommandLine/CommandLine.csproj b/src/CommandLine/CommandLine.csproj index 3764bcb6..da6792eb 100644 --- a/src/CommandLine/CommandLine.csproj +++ b/src/CommandLine/CommandLine.csproj @@ -8,6 +8,7 @@ $(DefineConstants);SKIP_FSHARP true ..\..\CommandLine.snk + true CommandLineParser CommandLineParser.FSharp diff --git a/src/CommandLine/Core/ReflectionExtensions.cs b/src/CommandLine/Core/ReflectionExtensions.cs index 2f4faf0f..cd75e07e 100644 --- a/src/CommandLine/Core/ReflectionExtensions.cs +++ b/src/CommandLine/Core/ReflectionExtensions.cs @@ -14,8 +14,6 @@ namespace CommandLine.Core { static class ReflectionExtensions { - public const string CannotSetValueToTargetInstance = "Cannot set value to target instance."; - public static IEnumerable GetSpecifications(this Type type, Func selector) { return from pi in type.FlattenHierarchy().SelectMany(x => x.GetTypeInfo().GetProperties()) @@ -93,10 +91,6 @@ public static TargetType ToTargetType(this Type type) private static IEnumerable SetValue(this SpecificationProperty specProp, T instance, object value) { - Action fail = inner => { - throw new InvalidOperationException(CannotSetValueToTargetInstance, inner); - }; - try { specProp.Property.SetValue(instance, value, null); @@ -110,13 +104,6 @@ private static IEnumerable SetValue(this SpecificationProperty specPro { return new[] { new SetValueExceptionError(specProp.Specification.FromSpecification(), e, value) }; } - catch(ArgumentException e) - { - var argEx = new ArgumentException(InvalidAttributeConfigurationError.ErrorMessage, e); - fail(argEx); - } - - return instance; } public static object CreateEmptyArray(this Type type) diff --git a/src/CommandLine/Error.cs b/src/CommandLine/Error.cs index 90ee26d8..2b586912 100644 --- a/src/CommandLine/Error.cs +++ b/src/CommandLine/Error.cs @@ -64,13 +64,7 @@ public enum ErrorType /// /// Value of type. /// - SetValueExceptionError, - - VersionRequestedError, - /// - /// Value of type. - /// - InvalidAttributeConfigurationError + SetValueExceptionError } /// diff --git a/src/CommandLine/Properties/AssemblyInfo.cs b/src/CommandLine/Properties/AssemblyInfo.cs index 4b4532b3..1dc94d20 100644 --- a/src/CommandLine/Properties/AssemblyInfo.cs +++ b/src/CommandLine/Properties/AssemblyInfo.cs @@ -2,4 +2,4 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("CommandLine.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015eb7571d696c075627830f9468969103bc35764467bdbccfc0850f2fbe6913ee233d5d7cf3bbcb870fd42e6a8cc846d706b5cef35389e5b90051991ee8b6ed73ee1e19f108e409be69af6219b2e31862405f4b8ba101662fbbb54ba92a35d97664fe65c90c2bebd07aef530b01b709be5ed01b7e4d67a6b01c8643e42a20fb4")] +[assembly: InternalsVisibleTo("CommandLine.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010009ab24ef889cd26bf46f7eaeda28e0fa5c04c50c93c6e121337b154bca0a1fd58ac6cb86195b709c2120f482730ced04a0e167a5758e56d3464bfabafe022b31510c39a61968fde795480dd60f6a396015c5f69a942074a3f4654b6dd66d0c63608bea78bdf96b35b1b48bb75741c2caad1f70579f286f1dbc2c560511c648d2")] diff --git a/tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs b/tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs deleted file mode 100644 index cedb1136..00000000 --- a/tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace CommandLine.Tests.Fakes -{ - class Options_With_InvalidDefaults - { - // Default of string and integer type property will also throw. - - [Option(Default = false)] - public string FileName { get; set; } - } -} diff --git a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs index eef9a674..c150d23a 100644 --- a/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs +++ b/tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs @@ -1133,21 +1133,6 @@ public void Parse_TimeSpan() // Teardown } - [Fact] - public void Build_DefaultBoolTypeString_ThrowsInvalidOperationException() - { - // Exercize system - Action test = () => InvokeBuild( - new string[] { }); - - // Verify outcome - test.ShouldThrow() - .WithMessage(ReflectionExtensions.CannotSetValueToTargetInstance) - .WithInnerException() - .WithInnerMessage(InvalidAttributeConfigurationError.ErrorMessage); - } - - [Fact] public void OptionClass_IsImmutable_HasNoCtor() { @@ -1163,7 +1148,7 @@ private class ValueWithNoSetterOptions } - public static IEnumerable RequiredValueStringData + public static IEnumerable RequiredValueStringData { get {