Skip to content

Commit

Permalink
Don't crash on Blazor, where PooledConnectionLifetime can't be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt committed Oct 10, 2022
1 parent f37c641 commit b1c0c9c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Serilog.Sinks.Seq/Sinks/Seq/Http/SeqIngestionApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using System;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Serilog.Events;
Expand All @@ -38,6 +39,9 @@ public SeqIngestionApiClient(string serverUrl, string? apiKey, HttpMessageHandle
_apiKey = apiKey;
_httpClient = messageHandler != null
? new HttpClient(messageHandler)
: RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))
// Can't set PooledConnectionLifetime on this platform
? new HttpClient()
:
#if SOCKETS_HTTP_HANDLER_ALWAYS_DEFAULT
new HttpClient(new SocketsHttpHandler
Expand Down

0 comments on commit b1c0c9c

Please sign in to comment.