Posting what happened to me here in case it helps others too. I copied a WPF XAML file into my Avalonia project and got this error because I forgot to rename the file .axaml instead of .xaml :)
.axaml
.xaml