AfterPlatformServicesSetup callbacks are called by AfterApplicationSetupCallback
Closed this issue · 1 comments
gentledepp commented
Describe the bug
When registering an AfterPlatformServicesSetup, it is invoked 2 times
- when the method SetupUnsafe calls the AfterPlatformServicesSetup
- when the method SetupUnsafe calls AfterApplicationSetupCallback
This is because there is a copy&paste-is issue in AppBuilder
:
The AfterApplicationSetupCallback is combined with the AfterPlatformServicesSetupCallback
[PrivateApi]
public AppBuilder AfterApplicationSetup(Action<AppBuilder> callback)
{
- AfterApplicationSetupCallback = (Action<AppBuilder>)Delegate.Combine(AfterPlatformServicesSetupCallback, callback);
+ AfterApplicationSetupCallback = (Action<AppBuilder>)Delegate.Combine(AfterApplicationSetupCallback , callback);
return Self;
}
To Reproduce
Register an AfterPlatformSericesSetup callback.
On the Platforms Browser and Android, they will get called twice
- when the method SetupUnsafe calls the AfterPlatformServicesSetup
- when the method SetupUnsafe calls AfterApplicationSetupCallback
Expected behavior
The callbyck should just be called once - at AfterPlatformServicesSetup
Avalonia version
11.2.1, 11.2.2
OS
WebAssembly, Android
Additional context
I will provide a PR shortly
gentledepp commented