Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash on Blazor, where PooledConnectionLifetime can't be specified #189

Merged
merged 1 commit into from
Oct 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, is there no built-in constant for this?

// Can't set PooledConnectionLifetime on this platform
? new HttpClient()
:
#if SOCKETS_HTTP_HANDLER_ALWAYS_DEFAULT
new HttpClient(new SocketsHttpHandler
Expand Down