You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the FontFamily field on an element is set to null, either directly by setting {x:Null} or indirectly via a binding, a NullReferenceException is raised internally once the element is evaluated. This will then crash the application as it never handles the exception.
To Reproduce
Add this element to a View: <TextBlock Text="hello" FontFamily="{x:Null}"/>
You can also bind it from a ViewModel and setting it to null from there:
View: <TextBlock Text="hello" FontFamily="{Binding Field}"/>
ViewModel: public FontFamily? Field => null;
Expected behavior
No response
Avalonia version
11.0.10
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered:
None in particular: we're migrating from WPF, and in the process of this we ran into this bug. I'm only really reporting it to raise awareness of it since it can be hard to track down the source, as the exception occurs internally in Avalonia. IMO it should at least give information of where you're passing null in the view so you can figure out where the mistake is made.
@timunie This issue is already fixed. The PR author has just forgot to add this issue, instead he took his own issue number which was commented as a duplicate of this one: #15896
Describe the bug
If the
FontFamily
field on an element is set tonull
, either directly by setting{x:Null}
or indirectly via a binding, aNullReferenceException
is raised internally once the element is evaluated. This will then crash the application as it never handles the exception.To Reproduce
Add this element to a View:
<TextBlock Text="hello" FontFamily="{x:Null}"/>
You can also bind it from a ViewModel and setting it to
null
from there:View:
<TextBlock Text="hello" FontFamily="{Binding Field}"/>
ViewModel:
public FontFamily? Field => null;
Expected behavior
No response
Avalonia version
11.0.10
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: