Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving the build error in the master branch #437

Merged
merged 3 commits into from Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file modified CommandLine.snk
Binary file not shown.
2 changes: 1 addition & 1 deletion 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

Expand Down
1 change: 1 addition & 0 deletions src/CommandLine/CommandLine.csproj
Expand Up @@ -8,6 +8,7 @@
<DefineConstants Condition="'$(BuildTarget)' != 'fsharp'">$(DefineConstants);SKIP_FSHARP</DefineConstants>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyOriginatorKeyFile>..\..\CommandLine.snk</AssemblyOriginatorKeyFile>

<SignAssembly>true</SignAssembly>
<PackageId Condition="'$(BuildTarget)' != 'fsharp'">CommandLineParser</PackageId>
<PackageId Condition="'$(BuildTarget)' == 'fsharp'">CommandLineParser.FSharp</PackageId>
Expand Down
13 changes: 0 additions & 13 deletions src/CommandLine/Core/ReflectionExtensions.cs
Expand Up @@ -14,8 +14,6 @@ namespace CommandLine.Core
{
static class ReflectionExtensions
{
public const string CannotSetValueToTargetInstance = "Cannot set value to target instance.";

public static IEnumerable<T> GetSpecifications<T>(this Type type, Func<PropertyInfo, T> selector)
{
return from pi in type.FlattenHierarchy().SelectMany(x => x.GetTypeInfo().GetProperties())
Expand Down Expand Up @@ -93,10 +91,6 @@ public static TargetType ToTargetType(this Type type)

private static IEnumerable<Error> SetValue<T>(this SpecificationProperty specProp, T instance, object value)
{
Action<Exception> fail = inner => {
throw new InvalidOperationException(CannotSetValueToTargetInstance, inner);
};

try
{
specProp.Property.SetValue(instance, value, null);
Expand All @@ -110,13 +104,6 @@ private static IEnumerable<Error> SetValue<T>(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)
Expand Down
8 changes: 1 addition & 7 deletions src/CommandLine/Error.cs
Expand Up @@ -64,13 +64,7 @@ public enum ErrorType
/// <summary>
/// Value of <see cref="CommandLine.SetValueExceptionError"/> type.
/// </summary>
SetValueExceptionError,

VersionRequestedError,
/// <summary>
/// Value of <see cref="CommandLine.InvalidAttributeConfigurationError"/> type.
/// </summary>
InvalidAttributeConfigurationError
SetValueExceptionError
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLine/Properties/AssemblyInfo.cs
Expand Up @@ -2,4 +2,4 @@

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("CommandLine.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010015eb7571d696c075627830f9468969103bc35764467bdbccfc0850f2fbe6913ee233d5d7cf3bbcb870fd42e6a8cc846d706b5cef35389e5b90051991ee8b6ed73ee1e19f108e409be69af6219b2e31862405f4b8ba101662fbbb54ba92a35d97664fe65c90c2bebd07aef530b01b709be5ed01b7e4d67a6b01c8643e42a20fb4")]
[assembly: InternalsVisibleTo("CommandLine.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010009ab24ef889cd26bf46f7eaeda28e0fa5c04c50c93c6e121337b154bca0a1fd58ac6cb86195b709c2120f482730ced04a0e167a5758e56d3464bfabafe022b31510c39a61968fde795480dd60f6a396015c5f69a942074a3f4654b6dd66d0c63608bea78bdf96b35b1b48bb75741c2caad1f70579f286f1dbc2c560511c648d2")]
11 changes: 0 additions & 11 deletions tests/CommandLine.Tests/Fakes/Options_With_InvalidDefaults.cs

This file was deleted.

17 changes: 1 addition & 16 deletions tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs
Expand Up @@ -1133,21 +1133,6 @@ public void Parse_TimeSpan()
// Teardown
}

[Fact]
public void Build_DefaultBoolTypeString_ThrowsInvalidOperationException()
{
// Exercize system
Action test = () => InvokeBuild<Options_With_InvalidDefaults>(
new string[] { });

// Verify outcome
test.ShouldThrow<InvalidOperationException>()
.WithMessage(ReflectionExtensions.CannotSetValueToTargetInstance)
.WithInnerException<ArgumentException>()
.WithInnerMessage(InvalidAttributeConfigurationError.ErrorMessage);
}


[Fact]
public void OptionClass_IsImmutable_HasNoCtor()
{
Expand All @@ -1163,7 +1148,7 @@ private class ValueWithNoSetterOptions
}


public static IEnumerable<object> RequiredValueStringData
public static IEnumerable<object[]> RequiredValueStringData
{
get
{
Expand Down