Skip to content

[NativeAOT] Fails to include _Microsoft.Android.Resource.Designer.dll from SkiaSharp.Views #10852

Description

@james-allison

Android framework version

net10.0-android

Affected platform version

VS 2026 18.3.1, Dotnet SDK 10.0.103, maui-android 10.0.103

Description

When the SKCanvasView from the SkiaSharp.Views.Maui.Controls package is included in a content page, Android NativeAOT builds crash when initialising the view.

A build warning is produced during the build suggesting that the _Microsoft.Android.Resources.Designer.dll library hasn't been linked.

Steps to Reproduce

Repro project at:

https://github.com/james-allison/dotnet-repros/tree/main/NativeAOT-Android-SkiaSharp

This is the basic MAUI sample app with the addition of the SkiaSharp.Views.Maui.Controls nuget package (v3.119.2).

A SKCanvasView control has been added to the MainPage.xaml.

The android debug config (and CoreCLR release config) builds and runs fine.

Building the android NativeAOT Release config will produce a warning:

1> ILC: Method '[SkiaSharp.Views.Android]SkiaSharp.Views.Android.SKCanvasView.Initialize(IAttributeSet)' will always throw because: Failed to load assembly '_Microsoft.Android.Resource.Designer'

The App then crashes immediately on initialising the MainPage.

Did you find any workaround?

None.

Relevant log output

During NativeAOT build:
1>  ILC: Method '[SkiaSharp.Views.Android]SkiaSharp.Views.Android.SKCanvasView.Initialize(IAttributeSet)' will always throw because: Failed to load assembly '_Microsoft.Android.Resource.Designer'

When the app is run, it crashes immediately with the following exception:


System.Exception: CurrentDomainOnUnhandledException
 ---\u003E System.IO.FileNotFoundException: IO_FileNotFound_FileName, _Microsoft.Android.Resource.Designer
IO_FileName_Name, _Microsoft.Android.Resource.Designer
   at Internal.Runtime.TypeLoaderExceptionHelper.CreateFileNotFoundException(ExceptionStringID, String) \u002B 0x50
   at SkiaSharp.Views.Android.SKCanvasView.Initialize(IAttributeSet) \u002B 0x18
   at SkiaSharp.Views.Maui.Handlers.SKCanvasViewHandler.CreatePlatformView() \u002B 0x38
   at Microsoft.Maui.Handlers.ViewHandler\u00602.OnCreatePlatformView() \u002B 0x58
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement) \u002B 0x58
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler) \u002B 0x124
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement, IMauiContext) \u002B 0x160
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement, IMauiContext) \u002B 0x2c
   at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView) \u002B 0xc8
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler) \u002B 0x124
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement, IMauiContext) \u002B 0x160
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement, IMauiContext) \u002B 0x2c
   at Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView(IView) \u002B 0xc8
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler) \u002B 0x124
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement, IMauiContext) \u002B 0x160
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement, IMauiContext) \u002B 0x2c
   at Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent(IContentViewHandler) \u002B 0xb4
   at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler, IElement) \u002B 0x8c
   at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement) \u002B 0x174
   at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView) \u002B 0x18
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler) \u002B 0x124
   at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement, IMauiContext) \u002B 0x160
   at Microsoft.Maui.Platform.ElementExtensions.ToPlatform(IElement, IMauiContext) \u002B 0x2c
   at Microsoft.Maui.Platform.NavigationViewFragment.OnCreateView(LayoutInflater, ViewGroup, Bundle) \u002B 0x9c
   at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState) \u002B 0x260

Activity

  1. added this to the .NET 11 milestone on Feb 23, 2026
  2. jonathanpeppers commented on Feb 23, 2026

    @jonathanpeppers
    Member

    /cc @simonrozsival we'll probably want to go test/fix this as we try to make NativeAOT less experimental.

  3. Marioo1357 commented on Jul 5, 2026

    @Marioo1357

    This issue is also valid on SkLottieView. The reason is that Skia want to load resources via

    var asm = Assembly.Load("_Microsoft.Android.Resource.Designer");

    This call isn't NativeAOT compatible. I don't know if this isn't the Skia issue?

  4. james-allison commented on Jul 5, 2026

    @james-allison
    Author

    Targeting net11-android37 with the dotnet 11-preview5 sdk - this is no longer a problem for my project (though remains an issue with net10-android)

  5. jonathanpeppers commented on Jul 6, 2026

    @jonathanpeppers
    Member

    NativeAOT will remain experimental in .NET 10 for sure, please let us know if this is still happening in future .NET 11 preview/RCs, thanks!

  6. locked and limited conversation to collaborators on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.Area: NativeAOTIssues that only occur when using NativeAOT.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions