Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Fix for issue #3 (#30)
Browse files Browse the repository at this point in the history
Fix for issue #3
  • Loading branch information
ejcoyle88 authored Nov 8, 2019
2 parents fafd84d + 4554b72 commit 39c2f5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Serilog.Enrichers.CorrelationId.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<copyright></copyright>
<tags>serilog enrichers enricher correlationid correlation id</tags>
<dependencies>
<group targetFramework="net45">
<group targetFramework="net452">
<dependency id="Serilog" version="2.4.0" />
</group>
<group targetFramework="netstandard2.0">
Expand All @@ -28,7 +28,7 @@
</dependencies>
</metadata>
<files>
<file src="Serilog.Enrichers.CorrelationId\bin\$target$\net45\*.dll" target="lib/net45" />
<file src="Serilog.Enrichers.CorrelationId\bin\$target$\net452\*.dll" target="lib/net452" />
<file src="Serilog.Enrichers.CorrelationId\bin\$target$\netstandard2.0\*.dll" target="lib/netstandard2.0" />
<file src="Serilog.Enrichers.CorrelationId\bin\$target$\netstandard2.1\*.dll" target="lib/netstandard2.1" />
</files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ private string GetCorrelationId()
var correlationId = string.IsNullOrEmpty(header)
? Guid.NewGuid().ToString()
: header;

#if NETFULL
if(!_contextAccessor.HttpContext.Response.Headers.AllKeys.Contains(_headerKey))
if(!_contextAccessor.HttpContext.Response.HeadersWritten &&
!_contextAccessor.HttpContext.Response.Headers.AllKeys.Contains(_headerKey))
#else
if (!_contextAccessor.HttpContext.Response.Headers.ContainsKey(_headerKey))
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>Serilog.Enrichers.CorrelationId</AssemblyName>
<RootNamespace>Serilog</RootNamespace>
<TargetFrameworks>net45;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net452;netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>7.3</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
Expand All @@ -14,7 +14,7 @@
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1'">
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45'">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net452'">
<DefineConstants>NET45;NETFULL</DefineConstants>
</PropertyGroup>

Expand All @@ -26,7 +26,7 @@
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Serilog" Version="2.9.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45'">
<ItemGroup Condition=" '$(TargetFramework)' == 'net452'">
<Reference Include="System.Web" />
<PackageReference Include="Serilog" Version="2.9.0" />
</ItemGroup>
Expand Down

0 comments on commit 39c2f5a

Please sign in to comment.