oxyplot-avalonia: Running into an Avalonia.Markup.Xaml.XamlLoadException

I updated my Avalonia project to 11.0.4, and trying to add oxyplot to my app. I add the NuGet package, add the Style in App.axaml,

<Application 
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AvaloniaGreenhouse"
    x:Class="AvaloniaGreenhouse.App">

    <Application.Styles>
        <SimpleTheme/>
        <StyleInclude Source="avares://OxyPlot.Avalonia/Themes/Default.axaml"/>
    </Application.Styles>
</Application>

Running the app to make sure it builds and runs, I get the following exception:

Avalonia.Markup.Xaml.XamlLoadException HResult=0x80131500 Message=No precompiled XAML found for avares://OxyPlot.Avalonia/Themes/Default.axaml (baseUri: avares://AvaloniaGreenhouse/App.axaml), make sure to specify x:Class and include your XAML file as AvaloniaResource Source=Avalonia.Markup.Xaml StackTrace: at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(IServiceProvider sp, Uri uri, Uri baseUri) at Avalonia.Markup.Xaml.Styling.StyleInclude.get_Loaded() at Avalonia.Markup.Xaml.Styling.StyleInclude.Avalonia.Controls.IResourceProvider.AddOwner(IResourceHost owner) at Avalonia.Styling.Styles.InternalAdd(IList items, IResourceHost owner) at Avalonia.Styling.Styles.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) at Avalonia.Collections.AvaloniaList1.NotifyAdd(T item, Int32 index) at Avalonia.Collections.AvaloniaList1.Add(T item) at Avalonia.Styling.Styles.Add(IStyle item) at AvaloniaGreenhouse.App.!XamlIlPopulate(IServiceProvider , App ) in C:\Projects\Meadow.Desktop.Samples\Source\Windows\AvaloniaGreenhouse\App.axaml:line 9 at AvaloniaGreenhouse.App.!XamlIlPopulateTrampoline(App ) at AvaloniaGreenhouse.App.Initialize() in C:\Projects\Meadow.Desktop.Samples\Source\Windows\AvaloniaGreenhouse\App.axaml.cs:line 14 at Avalonia.AppBuilder.SetupUnsafe() at Avalonia.AppBuilder.Setup() at Avalonia.AppBuilder.SetupWithLifetime(IApplicationLifetime lifetime) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode) at AvaloniaGreenhouse.App.Main(String[] args) in C:\Projects\Meadow.Desktop.Samples\Source\Windows\AvaloniaGreenhouse\App.axaml.cs:line 37

I’ve compared what I have with your example projects and I have no idea how to solve that exception.

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

If you have vague/throw-away questions, feel free to ask in the gitter: https://app.gitter.im/#/room/#oxyplot_oxyplot:gitter.im

Progress!

PXL_20230911_191959305

I was missing a few more setup things, fortunately was able to figure it out comparing with the samples (which now match the versions I have).

Thanks again. I might open more Issues if I run into any more hiccups. 😃