UI update problems in .NET UNO Platform

Hi sirs.
I am exploring the capabilities of a GUI application developed with the .NET UNO Platform.
The HelloWorld app works correctly on my Colibri board.
I then tried to build a more complex page (some images, buttons and text blocks).
Part of the UI tends to freeze and stop updating (both on the device and on my development machine)

I noticed the project references the following packages:

  • Microsoft.Extensions.Logging 5.0.0
  • Microsoft.Extensions.Logging.Console 5.0.0
  • Uno.UI.Adapter.Microsoft.Extensions.Logging 4.1.8
  • Uno.UI.RemoteControl 4.1.8
  • Uno.UI.Skia.Gtk 4.1.8

I noticed some of these packages are deprecated, so I updated all packages to latest versions:

  • Microsoft.Extensions.Logging 6.0.0
  • Microsoft.Extensions.Logging.Console 6.0.0
  • Uno.UI.Adapter.Microsoft.Extensions.Logging 4.4.13
  • Uno.UI.RemoteControl 4.4.13
  • Uno.UI.Skia.Gtk 4.4.13

My sample application now runs flawlessly on my development PC, but fails to start on the Toradex device.

When I update the package Uno.UI.Skia.Gtk I get the message:

GLIB UNHANDLED EXCEPTIONSystem.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Uno.UI.Runtime.Skia.GLRenderSurfaceBase.GLRenderSurface_Realized(Object sender, EventArgs e)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at GLib.Signal.ClosureInvokedCB(Object o, ClosureInvokedArgs args)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)

When I update the package Uno.UI.RemoteControl, I get the message:

Exception has occurred: CLR/System.MissingMethodException
An unhandled exception of type 'System.MissingMethodException' occurred in DotNetUnoPlatformExample.Skia.Gtk.dll: 'Method not found: 'Void Windows.UI.Xaml.Application.Start(Windows.UI.Xaml.ApplicationInitializationCallback, System.String[])'.'
   at Uno.UI.Runtime.Skia.GtkHost.Run()
   at DotNetUnoPlatformExample.Skia.Gtk.Program.Main(String[] args) in C:\Chinesport\Toradex\DotNetUnoPlatformExample\DotNetUnoPlatformExample.Skia.Gtk\Program.cs:line 19

My hardware setup:

  • Colibri iMX6DL 512MB v1.1Y
  • Iris V2.0A
  • TorizonCore Upstream 5.6.0+build.13 (dunfell)
  • Toradex Torizon Support v1.4.0

Can you please give me some direction on this?

I am not from Toradex but we have seen this issue before. Not sure if this help but our solution is:

  1. Make sure Uno version is up to date, as there was issue with wayland compositor in some version of Uno.

  2. Using software rendering instead of GL renderin, you can set this in the Program.Cs of Skia GTK project,

        var host = new GtkHost(() => new App(), args);
        host.RenderSurfaceType = RenderSurfaceType.Software;

Thanks Warren, this definitely solves the problem of the application not starting!
With software rendering my simple demo application occupies 50% cpu, so in any case I hope Toradex will fix this on the OpenGL side.
Thanks again!

Dear @Lorenzo thanks for reaching out.

Also, thanks @warrenlee for the suggestions, they were really useful.

@Lorenzo, can you please share more details about what you’re trying to do with this demo application for us to better understand what could be causing this CPU usage?

Which TorizonCore version are you using?

How many containers do you have up & running?

How are you measuring the CPU usage? Do you have any additional log?

It’s a simple UNO Platform sample app with:

  • 3 fixed TextBlocks
  • 3 TextBlocks displaying data received from a serial device (1 sample --4 bytes-- per second)
  • 7 TextBlocks with fixed text and font color changing according to device status
  • 1 png image with size animation

After some time, part of the UI stops to update (data is still arriving correctly).
This happens also with updated libraries on the device (Colibri iMX6DL 512MB v1.1Y)
OS image: TorizonCore Upstream 5.6.0+build.13 (dunfell)
I stop all containers apart from UNO Platform and Weston containers.
For CPU occupation I use the “top” command from a SSH shell.
I am not a Linux expert.

Hi @Lorenzo,

Can you please share the output of the top command on another topic in the community? This will help us to concentrate on topics. We’ll try to reproduce it on our side if possible.

Best regards,

Sure. I’ll do that

1 Like