-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the bug
I am trying to create a custom theme, deriving from Fluent theme
public partial class CustomTheme : FluentTheme
{
public CustomTheme (IServiceProvider? sp = null)
: base(sp) // notice I am calling the base class constructor
{ }
}The code above triggers this error:
AVL3000 No call to AvaloniaXamlLoader.Load(this) call found anywhere in the type ... and type seems to have custom constructors.
Which is produced by the check located here:
| if (!foundXamlLoader) |
The problem is that the code above checks for an explicit call to AvaloniaXamlLoader.Load(this); but does not check if the constructor calls :base() which in turns calls the xaml loader.
This results in producing an error that prevents build to complete, when the code is correct.
To Reproduce
public partial class CustomTheme : FluentTheme
{
public CustomTheme (IServiceProvider? sp = null)
: base(sp)
{ }
}Expected behavior
I expect the validation to check the code is correct and let it compile.
Avalonia version
11.3.12
OS
No response
Additional context
Not sure which would be the solution to fix this,
Ideally it should check for derived class calling the base constructor as an additional valid pattern.
Id that's too complex, maybe change the validation from error to warning, so it could be possible to use #pragma warning disable
Right now the only way I've found to circunvent this is adding the AvaloniaXamlLoader.Load(sp, this); to the constructor body, but this is effectively loading the xaml content twice.