Commit graph

29 commits

Author SHA1 Message Date
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