Commit graph

12 commits

Author SHA1 Message Date
Haselnussbomber
9001c96986
Return the resulting service, not the Task 2025-11-17 20:28:25 +01:00
Haselnussbomber
7ec1de4c76
Let IDalamudPluginInterface inherit from IServiceProvider 2025-11-17 20:28:24 +01:00
goaaats
69d8968dca IoC: Allow private scoped objects to resolve singleton services 2025-05-01 14:47:02 +02:00
Soreepeong
0a8f9b73fb Make ServiceScope IAsyncDisposable
ServiceScope.Dispose was not waiting for scoped services to complete
disposing. This had an effect of letting a new plugin instance register
a DtrBar entry before previous plugin instance's entry got unregistered.

This change also cleans up unloading procedure in LocalPlugin.
2024-08-18 07:58:45 +09:00
Soreepeong
a725bbf8e0 cleanup 2024-07-24 19:27:13 +09:00
Soreepeong
db3e9a4171 Add IDalamudPluginInterface.InjectAsync 2024-07-24 19:17:31 +09:00
Soreepeong
4b98f4e60a Remove nullability from IServiceScope.CreateAsync 2024-07-24 18:57:44 +09:00
Soreepeong
32b24b3b5a Fix ServiceScope.CreatePrivateScopedObject concurrency 2024-07-24 18:40:18 +09:00
Kaz Wolfe
28ff62e488
fix errors/warnings 2024-06-16 16:45:18 -07:00
goat
448b0d16ea
Add "loading dialog" for service init, unify blocking logic (#1779)
* wip

* hacky fix for overlapping event text in profiler

* move IsResumeGameAfterPluginLoad logic to PluginManager

* fix some warnings

* handle exceptions properly

* remove ability to cancel, rename button to "hide" instead

* undo Dalamud.Service refactor for now

* warnings

* add explainer, show which plugins are still loading

* add some text if loading takes more than 3 minutes

* undo wrong CS merge
2024-04-21 17:28:37 +02:00
srkizer
87b9edb448
Add IInternal/PublicDisposableService (#1696)
* Add IInternal/PublicDisposableService

Plugins are exposed interfaces that are not inherited from
`IDisposable`, but services implementing plugin interfaces often
implement `IDisposable`. Some plugins may try to call
`IDisposable.Dispose` on everything provided, and it also is possible to
use `using` clause too eagerly while working on Dalamud itself, such as
writing `using var smth = await Service<SomeService>.GetAsync();`. Such
behaviors often lead to a difficult-to-debug errors, and making those
services either not an `IDisposable` or making `IDisposable.Dispose` do
nothing if the object has been loaded would prevent such errors. As
`ServiceManager` must be the only class dealing with construction and
disposal of services, `IInternalDisposableService` has been added to
limit who can dispose the object. `IPublicDisposableService` also has
been added to classes that can be constructed and accessed directly by
plugins; for those, `Dispose` will be ignored if the instance is a
service instance, and only `DisposeService` will respond.

In addition, `DalamudPluginInterface` and `UiBuilder` also have been
changed so that their `IDisposable.Dispose` no longer respond, and
instead, internal functions have been added to only allow disposal from
Dalamud.

* Cleanup

* Postmerge fixes

* More explanation on RunOnFrameworkThread(ClearHooks)

* Mark ReliableFileStorage public ctor obsolete

---------

Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
2024-03-16 15:58:05 +00:00
goat
daa9f72218
IOC: scoped/on-demand services (#1120) 2023-05-21 22:43:28 +02:00