`AvaloniaSynchronizationContext` was previously queuing continuations with `Send` priority, which is the maximum. This was causing the problem described in https://github.com/AvaloniaUI/Avalonia/issues/6930#issuecomment-1008888711. Decrease the priority so that continuations don't get called during `Window` construction on macOS.
* Add nullable annotations...
...to `AvaloniaObject`/`AvaloniaProperty`-related classes and a few other uncontroversial files.
* Check for null before first use.
* Don't need this check as base class does it.
* Send one notification per sequential range in RemoveAll method of AvaloniaList (optimized)
* Simplified
* Make unit tests a bit more understandable.
Co-authored-by: Gitea <gitea@fake.local>
Co-authored-by: Dariusz Komosiński <darek.komosinski@gmail.com>
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
Co-authored-by: Steven Kirk <grokys@gmail.com>
The code suggested by the user makes sense to me. Reproed issue with
` try
{
var ctx = SynchronizationContext.Current;
await Task.Run(() => ctx.Send(state => throw new ArgumentException("hello"), null));
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
}
catch (AggregateException ex)
{
Console.WriteLine(ex.Message);
}` this code
* Fix#6224
* Fix data templates Match
* Do not use preview features
* Do not create Child if Content is null and DataTemplate was set
* Update src/Avalonia.Base/Utilities/TypeUtilities.cs
* Update src/Avalonia.Controls/Presenters/ContentPresenter.cs
* Update src/Avalonia.Controls/Presenters/ContentPresenter.cs
We were previously calling `Optional.GetValueOrDefault<T>()` in order to convert an `Optional<object>` to an `Optional<T>` which meant that empty values were getting converted to default values, meaning that in certain cases change notifications weren't raised.
Add an `Optional<object>.Cast<T>()` methods (like we have in `BindingValue`) and use that in order to preserve empty values when ending a batch update operation.