Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#389 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 6 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
backend, devtools

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C#
Estrellas
573
Forks
143
Merge medio
5 d 9 h
PR fusionados (30 d)
1

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de exceptionless/Exceptionless.Net

Todos los issues de exceptionless/Exceptionless.Net

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.