Skip to content

Commit 3025dfc

Browse files
authored
Merge pull request #189 from nblumhardt/runtime-info-blazor-check
Don't crash on Blazor, where PooledConnectionLifetime can't be specified
2 parents f37c641 + b1c0c9c commit 3025dfc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Serilog.Sinks.Seq/Sinks/Seq/Http/SeqIngestionApiClient.cs

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System;
1616
using System.Net.Http;
17+
using System.Runtime.InteropServices;
1718
using System.Text;
1819
using System.Threading.Tasks;
1920
using Serilog.Events;
@@ -38,6 +39,9 @@ public SeqIngestionApiClient(string serverUrl, string? apiKey, HttpMessageHandle
3839
_apiKey = apiKey;
3940
_httpClient = messageHandler != null
4041
? new HttpClient(messageHandler)
42+
: RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))
43+
// Can't set PooledConnectionLifetime on this platform
44+
? new HttpClient()
4145
:
4246
#if SOCKETS_HTTP_HANDLER_ALWAYS_DEFAULT
4347
new HttpClient(new SocketsHttpHandler

0 commit comments

Comments
 (0)