Skip to content

Commit 12a5e83

Browse files
authored
Merge pull request #138 from MV10/issue_86
fixes #86 as described in the issue Additional check-ins: xunit was throwing a "could not find dependent assembly" execption when launched from VS and in appveyor, but not from the command-line. Known issue, latest release fixes the problem.
2 parents 38d9ae8 + f1da59c commit 12a5e83

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/MSSqlServerSinkTraits.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ public MSSqlServerSinkTraits(string connectionString, string tableName, string s
5252
FormatProvider = formatProvider;
5353

5454
ExcludedColumnNames = new List<string>(ColumnOptions.Store.Count + 1);
55-
ExcludedColumnNames.Add("id");
56-
foreach (var column in ColumnOptions.Store)
57-
ExcludedColumnNames.Add(column.ToString());
55+
ExcludedColumnNames.Add(ColumnOptions.Id.ColumnName ?? "Id");
56+
if (ColumnOptions.Store.Contains(StandardColumn.Message)) ExcludedColumnNames.Add(ColumnOptions.Message.ColumnName ?? "Message");
57+
if (ColumnOptions.Store.Contains(StandardColumn.MessageTemplate)) ExcludedColumnNames.Add(ColumnOptions.MessageTemplate.ColumnName ?? "MessageTemplate");
58+
if (ColumnOptions.Store.Contains(StandardColumn.Level)) ExcludedColumnNames.Add(ColumnOptions.Level.ColumnName ?? "Level");
59+
if (ColumnOptions.Store.Contains(StandardColumn.TimeStamp)) ExcludedColumnNames.Add(ColumnOptions.TimeStamp.ColumnName ?? "TimeStamp");
60+
if (ColumnOptions.Store.Contains(StandardColumn.Exception)) ExcludedColumnNames.Add(ColumnOptions.Exception.ColumnName ?? "Exception");
61+
if (ColumnOptions.Store.Contains(StandardColumn.Properties)) ExcludedColumnNames.Add(ColumnOptions.Properties.ColumnName ?? "Properties");
62+
if (ColumnOptions.Store.Contains(StandardColumn.LogEvent)) ExcludedColumnNames.Add(ColumnOptions.LogEvent.ColumnName ?? "LogEvent");
5863

5964
if (ColumnOptions.AdditionalDataColumns != null)
6065
AdditionalDataColumnNames = new HashSet<string>(ColumnOptions.AdditionalDataColumns.Select(c => c.ColumnName), StringComparer.OrdinalIgnoreCase);
@@ -114,7 +119,7 @@ private KeyValuePair<string, object> GetStandardColumnNameAndValue(StandardColum
114119
case StandardColumn.Level:
115120
return new KeyValuePair<string, object>(ColumnOptions.Level.ColumnName ?? "Level", ColumnOptions.Level.StoreAsEnum ? (object)logEvent.Level : logEvent.Level.ToString());
116121
case StandardColumn.TimeStamp:
117-
return new KeyValuePair<string, object>(ColumnOptions.TimeStamp.ColumnName ?? "TimeStamp", ColumnOptions.TimeStamp.ConvertToUtc ? logEvent.Timestamp.DateTime.ToUniversalTime() : logEvent.Timestamp.DateTime);
122+
return new KeyValuePair<string, object>(ColumnOptions.TimeStamp.ColumnName ?? "TimeStamp", ColumnOptions.TimeStamp.ConvertToUtc ? logEvent.Timestamp.ToUniversalTime().DateTime : logEvent.Timestamp.DateTime);
118123
case StandardColumn.Exception:
119124
return new KeyValuePair<string, object>(ColumnOptions.Exception.ColumnName ?? "Exception", logEvent.Exception != null ? logEvent.Exception.ToString() : null);
120125
case StandardColumn.Properties:

test/Serilog.Sinks.MSSqlServer.Tests/Serilog.Sinks.MSSqlServer.Tests.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
4343
<Reference Include="System" />
4444
<Reference Include="Microsoft.CSharp" />
45-
<PackageReference Include="xunit" Version="2.2.0" />
46-
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" NoWarn="NU1701" />
45+
<PackageReference Include="xunit" Version="2.3.0" />
46+
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" NoWarn="NU1701" />
4747
<Compile Include="Configuration\NetFramework.ConfigurationManager\**\*.cs" />
4848
</ItemGroup>
4949

@@ -56,7 +56,10 @@
5656
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
5757
<PackageReference Include="xunit" Version="2.3.0" />
5858
<PackageReference Include="xunit.core" Version="2.3.0" />
59-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" NoWarn="NU1701" />
59+
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" NoWarn="NU1701">
60+
<PrivateAssets>all</PrivateAssets>
61+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
62+
</PackageReference>
6063
<Compile Include="Configuration\Microsoft.Extensions.Configuration\**\*.cs" />
6164
</ItemGroup>
6265

0 commit comments

Comments
 (0)