Skip to content

Level.StoreAsEnum is broken #43

@h0gh

Description

@h0gh

In the recent changes to support custom column names, it seems the support for storing Level as an enum was broken. (See commit cdd7999 changes to /src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/MSSqlServerSink.cs)

I believe this can be fixed by changing the value of the MaxLength property from 0 to -1 when StoreAsEnum is true, as a value of 0 causes ADO.Net to barf with an exception about non-string datatypes and non-negative MaxLength not being supported. (How's that for triple-negation!)

The functionality works in version 4.0.0 of the Nuget package, but not in version 4.1.0

Thanks in advance!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions