diff --git a/src/Serilog.Sinks.Console/project.json b/src/Serilog.Sinks.Console/project.json index 7ed4f0806..43cc8364a 100644 --- a/src/Serilog.Sinks.Console/project.json +++ b/src/Serilog.Sinks.Console/project.json @@ -15,7 +15,7 @@ "frameworks": { "net45": { }, - "dotnet5.1": { + "dotnet5.3": { "dependencies": { "System.Console": "4.0.0-beta-23516" } diff --git a/src/Serilog/Context/LogContext.cs b/src/Serilog/Context/LogContext.cs index 958886b13..d724c8edf 100644 --- a/src/Serilog/Context/LogContext.cs +++ b/src/Serilog/Context/LogContext.cs @@ -59,8 +59,13 @@ public static class LogContext { #if ASYNCLOCAL static readonly AsyncLocal> Data = new AsyncLocal>(); +#else +#if DOTNET5_1 + [ThreadStatic] + static ImmutableStack Data; #else static readonly string DataSlotName = typeof(LogContext).FullName; +#endif #endif /// @@ -151,6 +156,21 @@ static ImmutableStack Enrichers Data.Value = GetContext(value); } } +#else + +#if DOTNET5_1 + static ImmutableStack Enrichers + { + get + { + return Data; + } + set + { + Data = GetContext(value); + } + } + #else static ImmutableStack Enrichers { @@ -180,6 +200,7 @@ static ImmutableStack Enrichers } } #endif +#endif #if REMOTING /// diff --git a/src/Serilog/project.json b/src/Serilog/project.json index 51a9aff00..428d4f018 100644 --- a/src/Serilog/project.json +++ b/src/Serilog/project.json @@ -19,7 +19,7 @@ "dotnet5.1": { "compilationOptions": { "keyFile": "../../assets/Serilog.snk", - "define": [ "NO_APPDOMAIN" ] + "define": [ "NO_APPDOMAIN", "LOGCONTEXT" ] }, "dependencies": { "Microsoft.CSharp": "4.0.1-beta-23516",