Commit graph

43 commits

Author SHA1 Message Date
Haselnussbomber
9ea417c9ef
Fix GetService getting stuck in Task 2025-11-17 20:28:25 +01:00
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
srkizer
aa3d6c3efe
Use long running task for plugin ctor (#2406) 2025-09-29 09:09:02 -07: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
Soreepeong
d16e783466 Isolate plugin constructors to separate threads 2024-07-21 15:30:22 +09:00
Kaz Wolfe
28ff62e488
fix errors/warnings 2024-06-16 16:45:18 -07:00
KazWolfe
0c8c4bfdbf
chore: Remove the [InterfaceVersion] attribute (#1844) 2024-06-16 13:01:17 +02: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
goaaats
ec122c85d5 fix warnings 2024-03-19 23:24:23 +01: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
srkizer
b66be84b93
Better Service dependency handling (#1535) 2023-11-28 22:20:16 +01:00
goat
4a1b220d4a
fix: register interfaces for provided services 2023-09-30 01:09:25 +02:00
goat
4b9de31240
fix: scoped services must register their dependencies with PluginManager to ensure the backing services are kept alive long enough 2023-09-29 20:52:14 +02:00
goat
ab9b7e1602
chore: add data widget for servicecontainer status, remove serveropcode data widget 2023-09-17 20:35:40 +02:00
goat
ee181c9a89
feat(DI): support scoped services with interfaces 2023-08-02 23:04:59 +02:00
goat
284001ce6b
Interface support for plugin DI (#1235)
* feat: interface support for plugin DI
* attribute to indicate resolvability should be on the service instead of the interface
2023-06-13 11:10:47 -07:00
goat
daa9f72218
IOC: scoped/on-demand services (#1120) 2023-05-21 22:43:28 +02:00
goat
5a7f509941
fix: inherently depend on ChatGui in PluginManager 2023-02-12 21:56:59 +01:00
goat
f40ea4310c
feat: add InherentDependencyAttribute, mark PM inherently dependent on IM 2023-02-02 22:57:39 +01:00
goat
987ff8dc8f
chore: convert Dalamud to file-scoped namespaces 2022-10-29 15:23:22 +02:00
goat
ba5f3eae3b
refactor: remove unused usings 2022-07-03 17:09:52 +02:00
kizer
3369f569fb
Add call-on-services-ready attribute for service methods, and fix scene nullability (#900) 2022-06-26 18:49:34 +02:00
kizer
c7dc8c81f4
Fix async plugin load and show full profiler (#898) 2022-06-25 19:34:40 +02:00
goaaats
5870c91bb4
fix: Create() => CreateAsync(), fix custom plugin IoC 2022-06-24 23:11:16 +02:00
kizer
8e7f370ddd
Load services asynchronously whenever possible (#893) 2022-06-24 22:12:51 +02:00
Anna Clemens
7ec00462ac
chore: mark PluginServiceAttribute with MeansImplicitUse 2022-01-30 17:15:20 -05:00
goat
1561fbac00
Revert "refactor(Dalamud): switch to file-scoped namespaces"
This reverts commit b5f34c3199.
2021-11-18 15:23:40 +01:00
goat
b5f34c3199
refactor(Dalamud): switch to file-scoped namespaces 2021-11-17 19:42:32 +01:00
goat
fd044f9353
fix: reword ctor == null IoC error message 2021-08-24 20:59:24 +02:00
goat
76cefe366d
fix: correctly inject scopedObjects into Properties 2021-08-24 02:18:18 +02:00
goat
5f19abd979
fix: wrong parameters for IoC 2021-08-24 01:49:26 +02:00
goat
6fb19c1c81
fix: allow RequiredVersionAttribute on Properties 2021-08-24 01:35:52 +02:00
goat
48081bba7d
feat: inject properties before calling ctor 2021-08-24 00:39:17 +02:00
Raymond
ca39735022 Incorrect logic in ServiceContainer version check 2021-08-22 07:59:03 -04:00
Raymond
506731d7fe Implement DI for scratchpad 2021-08-21 16:01:45 -04:00
Raymond
2fe8ccb1da Implement ioc container 2021-08-21 14:03:06 -04:00
Raymond
ff1d7f2829 Implement service locator 2021-08-21 14:03:06 -04:00