Skip to content

Commit

Permalink
Review feedback - avoid package dependency on platforms without nativ…
Browse files Browse the repository at this point in the history
…e ValueTuple
  • Loading branch information
nblumhardt committed Jun 1, 2017
1 parent f3d2edd commit 888a498
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
12 changes: 11 additions & 1 deletion src/Serilog/Parameters/PropertyValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,20 @@ static bool TryConvertValueTuple(object value, Destructuring destructuring, Type
}

var definition = valueType.GetGenericTypeDefinition();

// Ignore the 8+ value case for now.
#if VALUETUPLE
if (definition == typeof(ValueTuple<>) || definition == typeof(ValueTuple<,>) ||
definition == typeof(ValueTuple<,,>) || definition == typeof(ValueTuple<,,,>) ||
definition == typeof(ValueTuple<,,,,>) || definition == typeof(ValueTuple<,,,,,>) ||
definition == typeof(ValueTuple<,,,,,,>)) // Ignore the 8+ value case for now.
definition == typeof(ValueTuple<,,,,,,>))
#else
var defn = definition.FullName;
if (defn == "System.ValueTuple`1" || defn == "System.ValueTuple`2" ||
defn == "System.ValueTuple`3" || defn == "System.ValueTuple`4" ||
defn == "System.ValueTuple`5" || defn == "System.ValueTuple`6" ||
defn == "System.ValueTuple`7")
#endif
{
var elements = new List<LogEventPropertyValue>();
foreach (var field in valueType.GetTypeInfo().DeclaredFields)
Expand Down
50 changes: 23 additions & 27 deletions src/Serilog/Serilog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,40 @@
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.0' ">
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
<PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.0.1" />
<PackageReference Include="System.Collections" Version="4.0.11" />
<PackageReference Include="System.Dynamic.Runtime" Version="4.0.11" />
<PackageReference Include="System.Globalization" Version="4.0.11" />
<PackageReference Include="System.Linq" Version="4.1.0" />
<PackageReference Include="System.Reflection" Version="4.1.0" />
<PackageReference Include="System.Reflection.Extensions" Version="4.0.1" />
<PackageReference Include="System.Runtime" Version="4.1.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.1.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.1.0" />
<PackageReference Include="System.Threading" Version="4.0.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
<PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
<PackageReference Include="System.Collections.NonGeneric" Version="4.0.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.0.1" />
<PackageReference Include="System.Collections" Version="4.0.11" />
<PackageReference Include="System.Dynamic.Runtime" Version="4.0.11" />
<PackageReference Include="System.Globalization" Version="4.0.11" />
<PackageReference Include="System.Linq" Version="4.1.0" />
<PackageReference Include="System.Reflection" Version="4.1.0" />
<PackageReference Include="System.Reflection.Extensions" Version="4.0.1" />
<PackageReference Include="System.Runtime" Version="4.1.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.1.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.1.0" />
<PackageReference Include="System.Threading" Version="4.0.11" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
Expand Down
1 change: 1 addition & 0 deletions test/Serilog.Tests/Serilog.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="System.ValueTuple" Version="4.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
</ItemGroup>
Expand Down

0 comments on commit 888a498

Please sign in to comment.