Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with xaml compliation in AvaloniaUI

Tags:

avaloniaui

When i add new View to a project and try to build it this error occurs:

`System.Xaml.XamlException: No precompiled XAML found for Test.Views.SchemesView, make sure to specify x:Class and include your XAML file as AvaloniaResource
17:59:18.882 [Error]  Exception caught by FireAndForget
System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at AvaloniaVS.Services.PreviewerProcess.<OnMessageAsync>d__37.MoveNext() in D:\a\1\s\AvaloniaVS\Services\PreviewerProcess.cs:line 433
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
   at AvaloniaVS.Services.PreviewerProcess.<OnMessageAsync>d__37.MoveNext() in D:\a\1\s\AvaloniaVS\Services\PreviewerProcess.cs:line 433<---
`

How can it be resolved ?

like image 527
Red_Black Avatar asked Sep 12 '25 23:09

Red_Black


1 Answers

This error means that Avalonia XAML-compiler MSBuild task hasn't processed any XAML for SchemesView. It could be caused by several reasons:

  • You haven't added your XAML file as AvaloniaResource or EmbeddedResource
  • x:Class directive is missing or invalid
  • Your project doesn't directly referece Avalonia package. As of version 0.9.x direct reference is required because of compatibility with .NET Core 2.1 SDK, which lacks support for buildTransitive. This restriction will be probably lifted in 0.10.
like image 199
kekekeks Avatar answered Sep 15 '25 20:09

kekekeks