Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

ExceptionlessLoggerProvider(Action<ExceptionlessConfiguration>) configures and disposes the shared ExceptionlessClient.Default

Offen
#389 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 6 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
csharp
Bereich
backend, devtools

Rechercherichtung

Read src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLoggerProvider.cs, especially the Action<ExceptionlessConfiguration> constructor and Dispose method, then check the overloads in ExceptionlessLoggerExtensions.cs. Confirm how the constructor creates and owns its client, and run the logging provider tests if available. Done means these overloads use an independent client and disposing the provider leaves ExceptionlessClient.Default usable; the issue notes draft PR #368 already proposes this change.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

In Exceptionless.Extensions.Logging 6.2.0, AddExceptionless(apiKey) and AddExceptionless(Action<ExceptionlessConfiguration>) are documented as using "a new client", but the ExceptionlessLoggerProvider(Action<ExceptionlessConfiguration>) constructor they call uses the process-wide ExceptionlessClient.Default and marks it as owned (_shouldDispose = true). Disposing the provider disposes Default, which the rest of the app is still using.

Where

What happens

  • When the provider is disposed, ExceptionlessClient.Default is disposed: its settings-update timer is stopped, its configuration and queue event handlers are detached, and its dependency resolver is disposed. Default is a Lazy singleton, so it is never recreated, and everything else that uses it (ExceptionlessClient.Default.Submit*, services.AddExceptionless(), app.UseExceptionless(), the NLog and log4net integrations) keeps using the disposed instance. This happens when the provider is added to a LoggerFactory with factory.AddProvider(...) and the factory is disposed, or when the caller disposes the provider. (Through ILoggingBuilder.AddExceptionless(...) the provider is registered as a pre-built instance, so the container does not dispose it.)
  • In every path, the configuration passed to these overloads is applied to Default rather than a separate client. AddExceptionless(apiKey) also calls UseInMemoryStorage() and SetDefaultMinLogLevel(Trace) on Default, which changes the behavior of every other integration that uses it.

Expected

The provider creates and owns its own ExceptionlessClient, as the XML docs say, and only disposes a client it created.

Steps to reproduce

using (var factory = new LoggerFactory())
    factory.AddProvider(new ExceptionlessLoggerProvider(c => c.ApiKey = "API_KEY"));

// ExceptionlessClient.Default has now been disposed by the logger provider;
// for example, its internal settings timer is disposed.
ExceptionlessClient.Default.SubmitLog("after logger factory disposed");

Verified against the 6.2.0 NuGet packages: after the using block, ExceptionlessClient.Default is in its disposed state.

Suggested fix

Create a new client in the Action<ExceptionlessConfiguration> constructor (_client = new ExceptionlessClient();). The open draft PR #368 includes this change.

Vorherrschende Sprache
C#
Sterne
573
Forks
143
Ø Merge
5 T. 9 Std.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus exceptionless/Exceptionless.Net

Alle Issues in exceptionless/Exceptionless.Net

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.