Skip to content

Commit 6a6015e

Browse files
committed
Revert "Merge branch 'develop' of github.com:commandlineparser/commandline into develop" (5343c5d, reversing changes 9f91088)
1 parent b27cb7e commit 6a6015e

File tree

4 files changed

+1
-45
lines changed

4 files changed

+1
-45
lines changed

src/CommandLine/Core/ReflectionExtensions.cs

-13
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ namespace CommandLine.Core
1414
{
1515
static class ReflectionExtensions
1616
{
17-
public const string CannotSetValueToTargetInstance = "Cannot set value to target instance.";
18-
1917
public static IEnumerable<T> GetSpecifications<T>(this Type type, Func<PropertyInfo, T> selector)
2018
{
2119
return from pi in type.FlattenHierarchy().SelectMany(x => x.GetTypeInfo().GetProperties())
@@ -93,10 +91,6 @@ public static IEnumerable<Error> SetProperties<T>(
9391

9492
private static IEnumerable<Error> SetValue<T>(this SpecificationProperty specProp, T instance, object value)
9593
{
96-
Action<Exception> fail = inner => {
97-
throw new InvalidOperationException(CannotSetValueToTargetInstance, inner);
98-
};
99-
10094
try
10195
{
10296
specProp.Property.SetValue(instance, value, null);
@@ -110,13 +104,6 @@ private static IEnumerable<Error> SetValue<T>(this SpecificationProperty specPro
110104
{
111105
return new[] { new SetValueExceptionError(specProp.Specification.FromSpecification(), e, value) };
112106
}
113-
catch(ArgumentException e)
114-
{
115-
var argEx = new ArgumentException(InvalidAttributeConfigurationError.ErrorMessage, e);
116-
fail(argEx);
117-
}
118-
119-
return instance;
120107
}
121108

122109
public static object CreateEmptyArray(this Type type)

src/CommandLine/Error.cs

-5
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ public enum ErrorType
6565
/// Value of <see cref="CommandLine.SetValueExceptionError"/> type.
6666
/// </summary>
6767
SetValueExceptionError
68-
VersionRequestedError,
69-
/// <summary>
70-
/// Value of <see cref="CommandLine.InvalidAttributeConfigurationError"/> type.
71-
/// </summary>
72-
InvalidAttributeConfigurationError
7368
}
7469

7570
/// <summary>

tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs

-11
This file was deleted.

tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs

+1-16
Original file line numberDiff line numberDiff line change
@@ -1133,21 +1133,6 @@ public void Parse_TimeSpan()
11331133
// Teardown
11341134
}
11351135

1136-
[Fact]
1137-
public void Build_DefaultBoolTypeString_ThrowsInvalidOperationException()
1138-
{
1139-
// Exercize system
1140-
Action test = () => InvokeBuild<Options_With_InvalidDefaults>(
1141-
new string[] { });
1142-
1143-
// Verify outcome
1144-
test.ShouldThrow<InvalidOperationException>()
1145-
.WithMessage(ReflectionExtensions.CannotSetValueToTargetInstance)
1146-
.WithInnerException<ArgumentException>()
1147-
.WithInnerMessage(InvalidAttributeConfigurationError.ErrorMessage);
1148-
}
1149-
1150-
11511136
[Fact]
11521137
public void OptionClass_IsImmutable_HasNoCtor()
11531138
{
@@ -1163,7 +1148,7 @@ private class ValueWithNoSetterOptions
11631148
}
11641149

11651150

1166-
public static IEnumerable<object> RequiredValueStringData
1151+
public static IEnumerable<object[]> RequiredValueStringData
11671152
{
11681153
get
11691154
{

0 commit comments

Comments
 (0)