Skip to content

Files ending in .skia.cs are not included when using net9.0-browserwasm with SkiaRendererΒ #20875

Open

Description

@ramezgerges

Current behavior πŸ›

Extracted from #20853

Expected behavior 🎯

No response

How to reproduce it (as minimally and precisely as possible) πŸ”¬

No response

Workaround πŸ› οΈ

No response

Renderer 🎨

  • Skia
  • Native

Affected platforms πŸ“±πŸ’»πŸ–₯️

No response

Uno.Sdk version (and other relevant versions) πŸ“¦

No response

IDE version πŸ§‘β€πŸ’»

No response

Anything else we need to know? πŸ’¬

No response

Activity

  1. added theissue type on Jun 25, 2025
  2. added
    triage/untriaged
    difficulty/tbd
    on Jun 25, 2025
  3. changed the title [-]Files ending in `.skia.cs` are not included when using `net9.0-browserwasm` with `SkiaRenderer`[/-] [+]Files ending in `.skia.cs` are not included and `_UNO_SKIA__` is false when using `net9.0-browserwasm` with `SkiaRenderer`[/+] on Jun 25, 2025
  4. changed the title [-]Files ending in `.skia.cs` are not included and `_UNO_SKIA__` is false when using `net9.0-browserwasm` with `SkiaRenderer`[/-] [+]Files ending in `.skia.cs` are not included when using `net9.0-browserwasm` with `SkiaRenderer`[/+] on Jun 25, 2025
  5. ramezgerges commented on Jun 25, 2025

    @ramezgerges
    ContributorAuthor

    False alarm. It's actually working.

  6. lietu commented on Jul 26, 2025

    @lietu

    Are you sure? I just tested this myself and I can't seem to get a simple example to work where I transplanted the .skia.cs from the Uno.Samples/UI/SKCanvasElementShowcase to a project from a fresh template. Runs on desktop, fails to build for browserwasm, while a plain example without the .skia.cs runs fine for browserwasm.

    It seems like this repo reproduces the issue rather well: https://github.com/lietu/UnoSkiaWebAssemblyIssue/commits/main/

    In the repo:

    cd Example
    dotnet run -f net9.0-desktop

    Works fine.

    If you instead do:

    cd Example
    dotnet run -f net9.0-browserwasm
    

    You end up with a build failure that seems to indicate the .skia.cs file was not included:

    Using launch settings from /home/lietu/src/Example/Example/Properties/launchSettings.json...
    Building...
    CSC : error UXAML0001: The type {using:Example.Presentation}SKCanvasElementImpl could not be found
    /home/lietu/src/Example/Example/Presentation/MainPage.xaml(10,6): error UXAML0001: An error was found in Grid
    /home/lietu/src/Example/Example/Presentation/MainPage.xaml(9,4): error UXAML0001: An error was found in ScrollViewer
    /home/lietu/src/Example/Example/Presentation/MainPage.xaml(1,2): error UXAML0001: An error was found in Page
    CSC : error UXAML0001: Processing failed for file /home/lietu/src/Example/Example/Presentation/MainPage.xaml (Uno.UI.SourceGenerators.XamlGenerator.XamlParsingException: An error was found in Page
    /home/lietu/src/Example/Example/Presentation/MainPage.xaml.cs(11,14): error CS1061: 'MainPage' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'MainPage' could be found (are you missing a using directive or an assembly reference?)
    /home/lietu/src/Example/Example/Presentation/Shell.xaml.cs(7,14): error CS1061: 'Shell' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'Shell' could be found (are you missing a using directive or an assembly reference?)
    /home/lietu/src/Example/Example/Presentation/SecondPage.xaml.cs(7,14): error CS1061: 'SecondPage' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'SecondPage' could be found (are you missing a using directive or an assembly reference?)
    /home/lietu/src/Example/Example/App.xaml.cs(13,14): error CS1061: 'App' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type 'App' could be found (are you missing a using directive or an assembly reference?)
    /home/lietu/src/Example/Example/Presentation/Shell.xaml.cs(9,45): error CS0103: The name 'Splash' does not exist in the current context
    /home/lietu/src/Example/Example/obj/Debug/net9.0-browserwasm/Uno.Extensions.Navigation.Generators/Uno.Extensions.Navigation.Generators.ForceBindingsUpdateGenerator/Example.Presentation.MainPage.g.cs(17,15): error CS1061: 'MainPage' does not contain a definition for 'Bindings' and no accessible extension method 'Bindings' accepting a first argument of type 'MainPage' could be found (are you missing a using directive or an assembly reference?)
    /home/lietu/src/Example/Example/obj/Debug/net9.0-browserwasm/Uno.Extensions.Navigation.Generators/Uno.Extensions.Navigation.Generators.ForceBindingsUpdateGenerator/Example.Presentation.MainPage.g.cs(19,13): error CS1061: 'MainPage' does not contain a definition for 'Bindings' and no accessible extension method 'Bindings' accepting a first argument of type 'MainPage' could be found (are you missing a using directive or an assembly reference?)
    
    The build failed. Fix the build errors and run again.
    

    Could also just be I'm doing something wrong since the sample didn't really come with any documentation and the documentation on creating custom Skia components pretty much just refers to the sample.

    If I go to the SKCanvasElementShowcase sample project and dotnet run -f net8.0-browserwasm it also fails with some different exceptions:

    Using launch settings from /home/lietu/src/Uno.Samples/UI/SKCanvasElementShowcase/SKCanvasElementShowcase/Properties/launchSettings.json...
    Building...
    /usr/share/dotnet/sdk/9.0.300/Sdks/Microsoft.NET.Sdk.StaticWebAssets/targets/Microsoft.NET.Sdk.StaticWebAssets.Compression.targets(289,5): error MSB4018: 
      The "DiscoverPrecompressedAssets" task failed unexpectedly.
      System.InvalidOperationException: File length for '/home/lietu/src/Uno.Samples/UI/SKCanvasElementShowcase/SKCanvasElementShowcas
      e/bin/Debug/net8.0-browserwasm/dist/staticwebapp.config.json' is not defined.
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.Validate()
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.FromTaskItem(ITaskItem item)
         at System.Linq.Enumerable.ArraySelectIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
         at System.Linq.Enumerable.ArraySelectIterator`2.ToArray()
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.DiscoverPrecompressedAssets.Execute()
         at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
         at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLo
      ggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
    
    The build failed. Fix the build errors and run again.
    

    And well net9.0-browserwasm doesn't work because the project doesn't have a target for it.

  7. lietu commented on Jul 26, 2025

    @lietu

    Actually if I go in the same example project and just run dotnet build in the Example directory, the net9.0-desktop target succeeds, but net9.0-browserwasm, net9.0, and net9.0-android all fail with the same CSC : error UXAML0001: The type {using:Example.Presentation}SKCanvasElementImpl could not be found error.

  8. lietu commented on Jul 26, 2025

    @lietu

    If I open the SKCanvasElementShowcase project in Rider and select Android target in the run/debug configurations, then click Run, I run into https://youtrack.jetbrains.com/issue/RIDER-125880/Rider-always-compiles-all-TargetFrameworks-in-multi-TFM-projects causing the build to fail. So I had to remove these from <TargetFrameworks>:

          net8.0-windows10.0.22000;
          net8.0-ios;
          net8.0-maccatalyst;
    

    Even still I run into the same error above with staticwebapp.config.json:

    Image

    So can't confirm if this works on Android from the showcase either.

  9. added
    project/core-tools πŸ› οΈ
    difficulty/medium πŸ€”
    and removed
    triage/untriaged
    difficulty/tbd
    on Oct 17, 2025
  10. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor

    This issue has had no activity for 120 days. It will be closed in 10 days if there is no further activity. Remove the Stale label or leave a comment to keep it open.

  11. added
    stale
    on Oct 31, 2026
  12. removed
    stale
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

difficulty/medium πŸ€”project/core-tools πŸ› οΈ

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions