Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉
#389 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 6 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
csharp
領域
backend, devtools

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
C#
星號
573
分支
143
平均合併
5 天 9 小時
30 天內合併 PR
1

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

exceptionless/Exceptionless.Net 的其他 Issue

查看 exceptionless/Exceptionless.Net 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。