Fix dashboard plugins using static ServiceProvider (#3026)#3035
Merged
Conversation
…t scenarios (#3026) Replace static IServiceProvider fields in DashboardLiveEventsPlugin and DashboardHistoryPlugin with per-scheduler instance storage via SchedulerContext. This prevents ObjectDisposedException when multiple hosts exist in the same process (e.g. WebApplicationFactory integration tests) and one host disposes. Also wrap plugin listener callbacks in try-catch(ObjectDisposedException) so a dashboard failure never aborts Quartz's listener notification chain. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1. Store ServiceProvider in all schedulers via GetAllSchedulers(), not just the default, so named schedulers also get dashboard wiring. 2. Restore public static ServiceProvider properties with [Obsolete] to preserve source/binary compatibility on 3.x. 3. Make BroadcastToScheduler async so the try-catch covers asynchronous ObjectDisposedException from SignalR send, not just synchronous throws. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
I didn't even start it, and it's done :D thank you! |
1. Store IServiceProvider in SchedulerContext from ServiceCollectionSchedulerFactory.InitializeScheduler instead of MapQuartzDashboardCore. This keeps dashboard mapping passive (no eager scheduler creation) and handles scheduler recreation since InitializeScheduler runs for every new/replacement scheduler. 2. Fall back to the obsolete static ServiceProvider property when the context entry is absent, so external consumers that set the property directly still get working behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
IServiceProviderfields inDashboardLiveEventsPluginandDashboardHistoryPluginwith per-scheduler instance storage viaSchedulerContext, fixingObjectDisposedExceptionwhen multiple hosts exist in the same process (e.g.WebApplicationFactoryintegration tests)try-catch(ObjectDisposedException)so a dashboard failure never aborts Quartz's listener notification chainIServiceProviderinscheduler.ContextduringMapQuartzDashboard()instead of setting static fieldsFixes #3026
Test plan
dotnet build src/Quartz.Dashboard/Quartz.Dashboard.csproj)ObjectDisposedExceptionwhen multipleWebApplicationFactoryhosts run concurrently and one disposes🤖 Generated with Claude Code