Select the version of your OS from the tabs below. If you don't know the version you are using, run the command cat /etc/os-release
or cat /etc/issue
on the board.
Remember that you can always refer to the Torizon Documentation, there you can find a lot of relevant articles that might help you in the application development.
This article explains how to run and debug .NET Uno Applications on TorizonCore using the Visual Studio Code extension provided by Toradex.
The goal is to show a GUI interface using .NET Core Uno template and being able to debug the code with breakpoints using the Torizon Visual Studio Code Extension.
This article complies to the Typographic Conventions for Torizon Documentation.
Press F1
on Visual Studio Code and then type Torizon/.NET: Create .NET Core Application
to create an application:
After creating it write the application name on the same command bar:
Select a folder on system to store the project files:
After the folder selection, select the .NET Uno Application
as the type of project:
Then, choose the right target architecture of your board:
Type torizon
on the username label:
A .NET Core Uno project with the following files will be created:
Create a .Net Core Uno application
After configuring your project, you can now deploy and debug it. Since this is common to all languages supported by the extension, please refer to the section Deploy and Debug from the article Visual Studio Code Extension for Torizon.
Warning: To use the remote Hot Reload feature during a debug session, it is necessary to have performed the deploy and debug steps.
As shown in the video below, it is necessary that the Port and the Host IP are set to the appropriate values. Then, you can edit the .xaml
file been presented on the screen of target, save the changes and check the changes taking place in the application running:
After going through the process of deploying and debugging the application, you can now deploy and release it. Since this is common to all languages supported by the extension, please refer to the section Deploy and Release from the article Visual Studio Code Extension for Torizon.
It is also possible to run the application in Debug mode locally, on the development PC. In the Debug activity bar there are two target options. The default target .NET Launch (Torizon)
will deploy, debug and hot reload remotely, on a development board with Torizon. The target .NET Launch (Skia Uno Platform)
will run, debug and hot reload locally. Select it and press F5
to start the debug session locally:
For intellisense to work correctly, every time something on the XAML file changes it is necessary to perform a build of the solution, to generate the XAML symbols. The video below shows a Text Block being altered and a new Button being added:
It is possible to enable the fullscreen mode on the application by adding the following lines in the App.xaml.cs
file, as shown in the video below:
Warning: Pay attention to the correct line numbers
09: using Uno.UI.Runtime.Skia;
10: using System.Runtime.InteropServices;
89: if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) &&
(RuntimeInformation.OSArchitecture == Architecture.Arm ||
RuntimeInformation.OSArchitecture == Architecture.Arm64))
{
GtkHost.Window.Decorated = false;
GtkHost.Window.Fullscreen();
}
At the time of this publishing (March 16th, 2022) there are two issues known by our team with the v0.3
of the Uno platform extension for Visual Studio Code:
We have reported the issues and accordingly to the maintainers of the Uno platform extension for Visual Studio Code they are already working on it and hopefully in their next release they are both fixed.