Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The LiveChartsCore.SkiaSharpView.Uno.WinUi assemblies should have the LiveChartsCore.SkiaSharpView.WinUI #938

Closed
igiona opened this issue Feb 17, 2023 · 25 comments

Comments

@igiona
Copy link

igiona commented Feb 17, 2023

The LiveChartsCore.SkiaSharpView.Uno.WinUI Version 2.0.0-beta.701 assemblies have different namespaces compared to the LiveChartsCore.SkiaSharpView.WinUI Version 2.0.0-beta.701 assmeblies.

This cause issues while compiling cross-platform libraries which need to reference the one or the other package depending on the target (e.g. WASM or Windows).

Expected behavior
The .Uno* assemblies should have the same namespace as their respective non-Uno DLLs.

Additional context
Building a Uno app for WASM and Windows might require to load the packages which target different frameworks.

@jeromelaban
Copy link
Contributor

jeromelaban commented Mar 9, 2023

Here's a workaround:

As most of the types cannot be inherited from, the only possible solution is to use conditional exclusions for Uno (starting from Uno 4.8):

<Page x:Class="App1.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:App1"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

      xmlns:unolvc="http://uno.ui#using:LiveChartsCore.SkiaSharpView.Uno.WinUI"
      xmlns:winlvc="using:LiveChartsCore.SkiaSharpView.WinUI"
      mc:Ignorable="d unolvc"

      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <unolvc:CartesianChart Height="400"
                               Grid.Column="0"
                               Grid.Row="0"
                               Series="{Binding BackTofLeftSeries}"
                               TooltipPosition="Hidden"
                               AnimationsSpeed="00:00:00.000" />
        <winlvc:CartesianChart Height="400"
                               Grid.Column="0"
                               Grid.Row="0"
                               Series="{Binding BackTofLeftSeries}"
                               TooltipPosition="Hidden"
                               AnimationsSpeed="00:00:00.000" />
    </Grid>
</Page>

and the following exclusion in the corresponding csproj file:

<ItemGroup>
   <ExcludeXamlNamespaces Include="winlvc" />
   <IncludeXamlNamespaces Include="unolvc" />
</ItemGroup>

@igiona
Copy link
Author

igiona commented Mar 9, 2023

Here's a workaround:

As most of the types cannot be inherited from, the only possible solution is to use conditional exclusions for Uno (starting from Uno 4.8):

<Page x:Class="App1.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="using:App1"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

      xmlns:unolvc="http://uno.ui#using:LiveChartsCore.SkiaSharpView.Uno.WinUI"
      xmlns:winlvc="using:LiveChartsCore.SkiaSharpView.WinUI"
      mc:Ignorable="d unolvc"

      Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <unolvc:CartesianChart Height="400"
                               Grid.Column="0"
                               Grid.Row="0"
                               Series="{Binding BackTofLeftSeries}"
                               TooltipPosition="Hidden"
                               AnimationsSpeed="00:00:00.000" />
        <winlvc:CartesianChart Height="400"
                               Grid.Column="0"
                               Grid.Row="0"
                               Series="{Binding BackTofLeftSeries}"
                               TooltipPosition="Hidden"
                               AnimationsSpeed="00:00:00.000" />
    </Grid>
</Page>

and the following exclusion in the corresponding csproj file:

<ItemGroup>
   <ExcludeXamlNamespaces Include="winlvc" />
</ItemGroup>

With Windows WInUi as target it does work:
image

But the workaround doesn't work with WASM.
The code compiles, but the chart is not displayed.
image

@jeromelaban
Copy link
Contributor

@igiona you may also need to include this

   <IncludeXamlNamespaces Include="unolvc" />

I've updated the post above.

@igiona
Copy link
Author

igiona commented Mar 10, 2023

   <IncludeXamlNamespaces Include="unolvc" />

Indeed this helped, thanks!

@francoistanguay
Copy link

@beto-rodriguez Do you have plans on aligning the namespaces? Need help?

@beto-rodriguez
Copy link
Owner

I will take a look into this next week, and let you know, sorry about the late response.

@francoistanguay
Copy link

No worries, as usual, happy to have the team help and answer questions as needed

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Apr 27, 2023

After checking this out, it seems that there is a confusion here.

The package LiveChartsCore.SkiaSharpView.Uno.WinUi is for Uno.WinUI (also for the Uno.Windows project).
Then LiveChartsCore.SkiaSharpView.WinUI is for WinUI.

So there is no need to mix the namespaces and install both packages.

The package LiveChartsCore.SkiaSharpView.Uno.WinUi addresses the dependencies for all the supported platforms.

I also noticed that the LiveCharts docs for Uno are down and this could be causing the confusion (working on that), I keep investigating and trying to make this work with Uno 4.8, currently I am able to make it work every where but on wasm with this error.

I will keep this open while the docs are down.

@jeromelaban
Copy link
Contributor

Thanks for the update! The error you're getting is generally caused by an outdated/misaligned version of SkiaSharp. Which version are you building with?

@beto-rodriguez
Copy link
Owner

oh, I see there is a new version of SkiaSharp, I am on 2.88.2 will try to upgrade to fix that.

@jeromelaban
Copy link
Contributor

jeromelaban commented Apr 28, 2023

The package LiveChartsCore.SkiaSharpView.Uno.WinUi is for Uno.WinUI (also for the Uno.Windows project).
Then LiveChartsCore.SkiaSharpView.WinUI is for WinUI.

Regarding this, both packages are installed in the same project conditionally (particularly in libraries, which are now present by default in Uno projects) and are generally expected to be be useable from shared source, particularly in XAML from either Uno and WinUI Target Frameworks. In general, when code is shared between WinAppSDK and Uno, it's best to use the same namespaces (LiveChartsCore.SkiaSharpView.WinUI in this case).

@beto-rodriguez
Copy link
Owner

The error you're getting is generally caused by an outdated/misaligned version of SkiaSharp

@jeromelaban thanks! It works now! WindowsSDK, Wasm and Gtk are working, but on android it seems that the app is not starting:

image

That log is repeating over an over (already waited about 10 mins with no luck).

am I missing something? I am trying this at #994, I am not completely sure if I am missing something or this is an issue.

@jeromelaban
Copy link
Contributor

@beto-rodriguez Thanks for the update. This is quite curious. If you break on all exceptions, do you see anything showing up?

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented May 1, 2023

These are some errors I see in the log:

[EGL_emulation] eglCreateContext: 0x7ce45d16cbd0: maj 2 min 0 rcv 2
[EGL_emulation] eglMakeCurrent: 0x7ce45d16cbd0: ver 2 0 (tinfo 0x7ce66c76f180) (first time)
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.Abstractions.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Hosting.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.FileProviders.Physical.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.FileProviders.Abstractions.dll
[OpenGLRenderer] Davey! duration=848ms; Flags=1, FrameTimelineVsyncId=173824, IntendedVsync=40301309888467, Vsync=40301759888449, InputEventId=0, HandleInputStart=40301765645025, AnimationStart=40301765670225, PerformTraversalsStart=40301765890425, DrawStart=40302079668825, FrameDeadline=40301326555133, FrameInterval=40301765597525, FrameStartTime=16666666, SyncQueued=40302125514025, SyncStart=40302128609425, IssueDrawCommandsStart=40302129637425, SwapBuffers=40302153359725, FrameCompleted=40302161634825, DequeueBufferDuration=43400, QueueBufferDuration=627600, GpuCompleted=40302161424825, SwapBuffersCompleted=40302161634825, DisplayPresentTime=25769803779, 
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Configuration.Abstractions.dll [External]
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Hosting.dll [External]
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.FileProviders.Physical.dll [External]
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.FileProviders.Abstractions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.DependencyInjection.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.DependencyInjection.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Hosting.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Hosting.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Storage.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Storage.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Serialization.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Http.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Serialization.dll [External]
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Http.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Localization.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Localization.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Configuration.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.EnvironmentVariables.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.CommandLine.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Configuration.EnvironmentVariables.dll [External]
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Configuration.CommandLine.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Primitives.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Primitives.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.FileExtensions.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Configuration.FileExtensions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.Json.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Configuration.Json.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Json.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/System.Text.Json.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Options.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Options.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Configuration.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Logging.Configuration.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Options.ConfigurationExtensions.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Options.ConfigurationExtensions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Configuration.Binder.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Configuration.Binder.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Toolkit.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Toolkit.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Console.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Logging.Debug.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Logging.Console.dll [External]
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Logging.Debug.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Localization.Abstractions.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Localization.Abstractions.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Text.Encodings.Web.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/System.Text.Encodings.Web.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Serialization.Refit.dll
[monodroid-assembly] open_from_bundles: failed to load assembly UnoPlatformSample.DataContracts.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Serialization.Refit.dll [External]
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/UnoPlatformSample.DataContracts.dll
[monodroid-assembly] open_from_bundles: failed to load assembly Refit.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Refit.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly System.Runtime.Intrinsics.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/System.Runtime.Intrinsics.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Microsoft.Extensions.Http.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Microsoft.Extensions.Http.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Extensions.Http.Refit.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Extensions.Http.Refit.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Refit.HttpClientFactory.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Refit.HttpClientFactory.dll [External]
[monodroid-assembly] Shared library 'kernel32.dll' not loaded, p/invoke 'GetStdHandle' may fail
Thread started: Console logger queue processing thread #10
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.UI.Adapter.Microsoft.Extensions.Logging.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.UI.Adapter.Microsoft.Extensions.Logging.dll [External]
[monodroid-assembly] open_from_bundles: failed to load assembly Uno.Core.Extensions.Collections.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/Uno.Core.Extensions.Collections.dll [External]
[Choreographer] Skipped 75 frames!  The application may be doing too much work on its main thread.
[OpenGLRenderer] Davey! duration=1299ms; Flags=0, FrameTimelineVsyncId=173832, IntendedVsync=40301776555115, Vsync=40303026555065, InputEventId=0, HandleInputStart=40303031436025, AnimationStart=40303031462125, PerformTraversalsStart=40303050610825, DrawStart=40303074151425, FrameDeadline=40301809888447, FrameInterval=40303031193125, FrameStartTime=16666666, SyncQueued=40303074516925, SyncStart=40303074732825, IssueDrawCommandsStart=40303074832125, SwapBuffers=40303075156325, FrameCompleted=40303076532925, DequeueBufferDuration=24800, QueueBufferDuration=830500, GpuCompleted=40303076423825, SwapBuffersCompleted=40303076532925, DisplayPresentTime=549755813888, 
[0:] Uno.Extensions.Navigation.Navigators.ContentControlNavigator: Information: NavigateAsync - Starting Navigation - Navigator: ContentControlNavigator Request: 
[monodroid-assembly] Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
[DOTNET] �[40m�[32minfo�[39m�[22m�[49m: Uno.Extensions.Navigation.Navigators.ContentControlNavigator[0]
[DOTNET]       NavigateAsync - Starting Navigation - Navigator: ContentControlNavigator Request: 
[0:] Uno.Extensions.Navigation.Navigators.ContentControlNavigator: Warning: Show - Missing view for navigation path ''
[DOTNET] �[40m�[1m�[33mwarn�[39m�[22m�[49m: Uno.Extensions.Navigation.Navigators.ContentControlNavigator[0]
[DOTNET]       Show - Missing view for navigation path ''
[0:] Uno.Extensions.Navigation.Navigators.ContentControlNavigator: Information: CreateControlFromType - Creating control of type FrameView
[DOTNET] �[40m�[32minfo�[39m�[22m�[49m: Uno.Extensions.Navigation.Navigators.ContentControlNavigator[0]
[DOTNET]       CreateControlFromType - Creating control of type FrameView
[EGL_emulation] app_time_stats: avg=335.73ms min=2.07ms max=863.12ms count=3
[0:] Uno.Extensions.Navigation.Navigators.FrameNavigator: Information: NavigateAsync - Starting Navigation - Navigator: FrameNavigator Request: Main
[DOTNET] �[40m�[32minfo�[39m�[22m�[49m: Uno.Extensions.Navigation.Navigators.FrameNavigator[0]
[DOTNET]       NavigateAsync - Starting Navigation - Navigator: FrameNavigator Request: Main
[monodroid-assembly] open_from_bundles: failed to load assembly ViewModelsSamples.dll
Loaded assembly: /data/data/com.companyname.UnoPlatformSample/files/.__override__/ViewModelsSamples.dll
[CompatibilityChangeReporter] Compat change id reported: 171228096; UID 10153; state: ENABLED
[monodroid-assembly] open_from_bundles: failed to load assembly es/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly es/System.Private.CoreLib.resources.dll
[EGL_emulation] app_time_stats: avg=40.55ms min=4.76ms max=243.88ms count=25
[EGL_emulation] app_time_stats: avg=33.91ms min=32.29ms max=35.94ms count=30

@beto-rodriguez
Copy link
Owner

Full output:

output.txt

@jeromelaban
Copy link
Contributor

Got it, but does the debugger break on first chance exceptions? @nickrandolph may also know more about this as your sample uses navigation extensions.

@beto-rodriguez
Copy link
Owner

I do not see any break or exception on Visual Studio 17.5.4, the issue should be reproducible using the .sln found here.

That solution is the UnoApp template (4.8.9.10) and added the LiveCharts samples there.

@nickrandolph
Copy link

@beto-rodriguez looks like there's an exception when it's trying to load the samples.
If you comment this line out:


You should see the MainPage display. Then when you click on one of the samples you'll see the exception below:

[DOTNET] Failed to raise 'PointerPressedEvent': System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
[DOTNET] ---> System.NullReferenceException: Object reference not set to an instance of an object.
[DOTNET] at LiveChartsCore.SkiaSharpView.WinUI.MotionCanvas..ctor() in C:\source\github\beto-rodriguez\LiveCharts2\src\skiasharp\LiveChartsCore.SkiaSharpView.Uno.WinUI\MotionCanvas.xaml.cs:line 60
[DOTNET] at LiveChartsCore.SkiaSharpView.WinUI.CartesianChart.InitializeComponent_7A273A05() in C:\source\github\beto-rodriguez\LiveCharts2\src\skiasharp\LiveChartsCore.SkiaSharpView.Uno.WinUI\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\CartesianChart_ce87848fde8ea08b95ddadd4ed95529f.cs:line 72
[DOTNET] at LiveChartsCore.SkiaSharpView.WinUI.CartesianChart.InitializeComponent() in C:\source\github\beto-rodriguez\LiveCharts2\src\skiasharp\LiveChartsCore.SkiaSharpView.Uno.WinUI\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\CartesianChart_ce87848fde8ea08b95ddadd4ed95529f.cs:line 58
[DOTNET] at LiveChartsCore.SkiaSharpView.WinUI.CartesianChart..ctor() in C:\source\github\beto-rodriguez\LiveCharts2\src\skiasharp\LiveChartsCore.SkiaSharpView.Uno.WinUI\CartesianChart.xaml.cs:line 75
[DOTNET] at UnoWinUISample.Bars.DelayedAnimation.View.InitializeComponent_5EF819D9() in C:\source\github\beto-rodriguez\LiveCharts2\samples\UnoPlatformSample\UnoPlatformSample\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\View_ba5c74f25fe10ab4ebdb6f90716e9f4e.cs:line 72
[DOTNET] at UnoWinUISample.Bars.DelayedAnimation.View.InitializeComponent() in C:\source\github\beto-rodriguez\LiveCharts2\samples\UnoPlatformSample\UnoPlatformSample\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\View_ba5c74f25fe10ab4ebdb6f90716e9f4e.cs:line 58
[DOTNET] at UnoWinUISample.Bars.DelayedAnimation.View..ctor() in C:\source\github\beto-rodriguez\LiveCharts2\samples\UnoPlatformSample\UnoPlatformSample\LiveChartsSamples\Bars\DelayedAnimation\View.xaml.cs:line 9
[DOTNET] at System.Reflection.ConstructorInvoker.InterpretedInvoke(Object obj, Span`1 args, BindingFlags invokeAttr)
[DOTNET] --- End of inner exception stack trace ---
[DOTNET] at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
[DOTNET] at System.Activator.CreateInstance(Type type, Boolean nonPublic)
[DOTNET] at System.Activator.CreateInstance(Type type)
[DOTNET] at UnoPlatformSample.Presentation.MainPage.LoadSample(String route) in C:\source\github\beto-rodriguez\LiveCharts2\samples\UnoPlatformSample\UnoPlatformSample\Presentation\MainPage.xaml.cs:line 52
[DOTNET] at UnoPlatformSample.Presentation.MainPage.Border_PointerPressed(Object sender, PointerRoutedEventArgs e) in C:\source\github\beto-rodriguez\LiveCharts2\samples\UnoPlatformSample\UnoPlatformSample\Presentation\MainPage.xaml.cs:line 45
[DOTNET] at UnoPlatformSample.Presentation.MainPage._MainPage_5a7bff13257ebfb8e2656a5a6562f906_UnoPlatformSamplePresentationMainPageSC1.<>c__DisplayClass3_1.b__2(Object Border_PointerPressed_sender, PointerRoutedEventArgs Border_PointerPressed_e) in C:\source\github\beto-rodriguez\LiveCharts2\samples\UnoPlatformSample\UnoPlatformSample\Uno.UI.SourceGenerators\Uno.UI.SourceGenerators.XamlGenerator.XamlCodeGenerator\MainPage_5a7bff13257ebfb8e2656a5a6562f906.cs:line 402
[DOTNET] at Microsoft.UI.Xaml.UIElement.InvokeHandler(Object handler, RoutedEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.RoutedEvents.cs:line 938
[DOTNET] at Microsoft.UI.Xaml.UIElement.RaiseEvent(RoutedEvent routedEvent, RoutedEventArgs args, BubblingContext ctx) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.RoutedEvents.cs:line 677
[DOTNET] at Microsoft.UI.Xaml.UIElement.RaisePointerEvent(RoutedEvent evt, PointerRoutedEventArgs args, BubblingContext ctx) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.Pointers.cs:line 1155

@beto-rodriguez
Copy link
Owner

Thanks @nickrandolph! that helped me to find the issue!

It seems that on android the FrameworkElement.FindName() is not finding the canvas, while on the rest of the platforms is. Is there something else I can try there?

The issue happens here because _skiaElement is null on android.

@beto-rodriguez
Copy link
Owner

After some research it seems that the SkiaSharp view is not loaded on android (I think all the mobile project).

I followed your example here with no luck, notice I am using a newer template of Uno.

I created this repository without livecharts that illustrates the issue I am facing.

The highlights in that repo is that I am adding a reference SkiaSharp, but as illustrated on your example, on WindowsSDK I referenced SkiaSharp.Views.WinUI and on the rest of the platforms SkiaSharp.Views.Uno.WinUI.

Also in this sample I am not using the FindName method and just using using the name in the code I set via x:Name, but it seems that on mobile the view is not loaded (doing this at Presentation/MainPage):

image

@jeromelaban
Copy link
Contributor

jeromelaban commented May 2, 2023

The skia namespace is special in Uno's XAML, and in the context of a default template app, it gets removed from the visual tree because the skia rendering target cannot be detected. That feature is not yet compatible with class libraries until .NET 8 (until the net8.0-browser TFM is introduced).

In the meantime, try using a different namespace name.

@beto-rodriguez
Copy link
Owner

@jeromelaban Thanks for pointing that out! that totally fixed it! sorry and thanks for all your help!

@beto-rodriguez
Copy link
Owner

I will close this issue for now since namespaces are aligned now in the latest NuGet package, and the docs in the website are updated.

Thanks to all the Uno team for your help!

@jeromelaban
Copy link
Contributor

Very nice! Glad we could help, and thanks for working on this, the community will enjoy for sure!

@igiona
Copy link
Author

igiona commented May 8, 2023

I confirm it works, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants