Please clearly describe what the SQL Sink is doing incorrectly:
NullReferenceException at Serilog.Sinks.MSSqlServer.Output.AdditionalColumnDataGenerator.GetAdditionalColumnNameAndValue
Please clearly describe the expected behavior:
does not error
List the names and versions of all Serilog packages used in the project:
Serilog.AspNetCore 6.1.0
Serilog.Sinks.MSSqlServer 6.1.0
Target framework and operating system:
[ X ] .NET Core 6
Provide a simple reproduction of your Serilog configuration code:
var columnOptions = new ColumnOptions
{
DisableTriggers = true,
AdditionalColumns = new Collection<SqlColumn>
{
new SqlColumn {ColumnName = "UserName", DataType = SqlDbType.NVarChar, DataLength = 64},
new SqlColumn {ColumnName = "HttpRequestMethod", DataType = SqlDbType.NVarChar, DataLength = 32},
new SqlColumn {ColumnName = "RouteTemplate", DataType = SqlDbType.NVarChar, DataLength = 128},
new SqlColumn {ColumnName = "MachineName", DataType = SqlDbType.NVarChar, DataLength = 32},
new SqlColumn {ColumnName = "ClientId", DataType = SqlDbType.NVarChar, DataLength = 24},
new SqlColumn {ColumnName = "AccountNumber", DataType = SqlDbType.NVarChar, DataLength = 24},
new SqlColumn {ColumnName = "CorrelationId", DataType = SqlDbType.NVarChar, DataLength = 128}
}
};
columnOptions.Store.Remove(StandardColumn.Properties);
columnOptions.Store.Add(StandardColumn.LogEvent);
>> Provide a *simple* reproduction of your Serilog configuration file, if any:
Bug Report / Support Request Template
upgrading from 6.0.0 to 6.1.0
[ X ] .NET Core 6
.WriteTo.MSSqlServer( Configuration.GetConnectionString("SerilogDb"), sinkOptions: new MSSqlServerSinkOptions { AutoCreateSqlTable = false, TableName = Configuration.GetValue("AppOptions:SerilogTableName"),
BatchPeriod = TimeSpan.FromSeconds(5),
BatchPostingLimit = 50
},
columnOptions: columnOptions,
restrictedToMinimumLevel: restrictedToMinimumLevel
)