Skip to content

Support Target field in SinglePlayerDutyOptions; unload error fix - #792

Merged
alydevs merged 2 commits into
new-mainfrom
alydevs
Aug 31, 2026
Merged

Support Target field in SinglePlayerDutyOptions; unload error fix#792
alydevs merged 2 commits into
new-mainfrom
alydevs

Conversation

@alydevs

@alydevs alydevs commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Added ability to set initial target of a solo duty in a quest path. might fix a lot of cases where the only thing preventing a solo duty from running is targeting a boss. Below is summary of LLM-assisted fix for unload error introduced by IAsyncDalamudPlugin change @Kagekazu


Fix ObjectDisposedException on plugin unload

Since moving to IAsyncDalamudPlugin, unloading Questionable could throw ObjectDisposedException from
MovementController.Update via IFramework.Update. MS.DI's ServiceProviderEngineScope marks itself disposed at the
start of DisposeAsync, before walking the disposable list. Under the async plugin lifecycle Dalamud's framework
thread can tick between "scope flagged disposed" and DalamudInitializer being reached in the disposal walk, so
MovementController.Update's per-frame IServiceProvider.GetRequiredService<QuestController>() blew up on a dead
container. The classic sync Dispose path masked this because teardown ran inline without yielding the framework
thread.

Changes:

  • QuestionablePlugin.DisposeAsync: resolve and Dispose() DalamudInitializer before disposing the container
    (wrapped in try/catch (ObjectDisposedException) for the already-torn-down case), so Dalamud event subscriptions
    (Framework.Update, UiBuilder.*, toast hooks) are gone before the scope is flagged disposed.
  • DalamudInitializer.Dispose: added a _disposed guard so the explicit pre-container call plus MS.DI's later
    disposal walk are both safe.
  • MovementController: replaced the IServiceProvider constructor parameter with Lazy<QuestController>,
    breaking the QuestControllerMovementController ctor cycle without a runtime container lookup on the hot path.
    Registered explicitly as AddSingleton(sp => new Lazy<QuestController>(sp.GetRequiredService<QuestController>))
    (MS.DI doesn't auto-provide Lazy<T>).

Verified with dotnet build -c Release Questionable/Questionable.csproj (0 warnings, 0 errors) and by reloading the
plugin locally — the unload error no longer reproduces.

AI/LLM disclosure: implemented with Claude Opus 4.7 via pi. Diagnosis, fix design, and code were reviewed and
are owned by @alydevs.

@alydevs alydevs changed the title alydevs Support Target field in SinglePlayerDutyOptions; unload error fix Aug 31, 2026
@alydevs
alydevs merged commit 64e3ca9 into new-main Aug 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant