doc/articles/uno-howto-create-a-repro.md
This documentation describes the steps needed to create a "repro" or reproduction project, which will help the community and maintainers troubleshoot issues that you may find when developing with Uno Platform.
The goal of a repro app is to find the smallest possible piece of code that demonstrates the problem, with the least dependencies possible. This is needed to make the resolution as fast as possible, as the Uno Platform team and community members do not have access to your projects sources nor understand your own expertise domain.
Some steps and questions to answer:
dotnet new unoapp --preset=blank app.[!TIP] Watch out for the size of zip created. Check the section below on reducing the sample size.
mp4 files in issues.Find the smallest piece of API used by your app (XAML Control, method, type) and extract that code into the repro app
If it's impacting a control:
If you can't repro in a separate app because there are too many dependencies in your app try, removing as much code as you can around the use of failing API or Control. This may include removing implicit styles, global initializations.
If the control offers events, try adding logging to Loading/Unloading/PropertyChanged/LayoutUpdated or other available events to determine if the Control or API is interacting with your code in expected ways. Sometimes adding a breakpoint in the handler of those events can show interesting stack traces.
When debugging data bindings:
<TextBlock Text="{Binding}" /><TextBlock Text="{Binding MyProperty}" /><TextBlock Text="{Binding Command, ElementName=MyButton}" />DataContextChanged in the code behind to see if and when the DataContext changed.Analyze device and app logs for clues about the control's behavior. For Android-specific logging, see Android Debugging with Logcat below.
Windows, Microsoft, or Uno should be visible in the app's output. If not, make sure to setup the logging properly.Try on different versions of Visual Studio, iOS, Android, Linux, or browsers
If available, try the API on Windows (WinUI) and see if it behaves differently than what Uno Platform is doing
When issues occur, try breaking on all exceptions to check if an exception may be hidden and not reported.
Update Uno.WinUI or other dependencies to previous or later versions, using a bisection technique. Knowing which version of a package introduced an issue can help orient the investigations.
When debugging Android-specific issues, Logcat provides essential device and application logs. Here's how to access Logcat in different development environments:
Visual Studio provides built-in Logcat support through the Device Log window.
Accessing Logcat:
Filtering Logs:
Useful Tips:
Rider provides Logcat access through the Logcat tool window with advanced filtering capabilities.
Accessing Logcat:
Filtering and Searching:
Uno.*Exception)Useful Tips:
Prerequisites:
adb devices in the terminal to troubleshootVS Code requires manual ADB setup or extensions for Logcat viewing.
Prerequisites:
Install Android SDK (if not already installed):
C:\Users\<username>\AppData\Local\Android\Sdk~/Library/Android/sdk~/Android/SdkVerify ADB Installation:
<Android-SDK>/platform-tools/adbadb versionOpen VS Code's integrated terminal: View → Terminal or press Ctrl+** (Windows/Linux) or **⌘ (macOS)
Ensure your device or emulator is running and connected
Verify device connection:
adb devices
Start viewing logs:
# View all logs (verbose)
adb logcat
# Clear previous logs first
adb logcat -c
# Filter by your app's package name (Linux/macOS or other bash-like shells)
adb logcat | grep "com.yourcompany.yourapp"
# Windows PowerShell equivalent:
# adb logcat | Select-String "com.yourcompany.yourapp"
# Windows CMD equivalent:
# adb logcat | findstr "com.yourcompany.yourapp"
# Filter by log priority (E=Error, W=Warn, I=Info, D=Debug, V=Verbose)
adb logcat '*:E'
# Filter by tag (show only Uno logs)
adb logcat 'Uno:*' '*:S'
# Combination: Show Uno debug logs and all errors
adb logcat 'Uno:D' '*:E'
# Save logs to file
adb logcat > android-logs.txt
# Dump existing logs without continuous streaming
adb logcat -d
Open the Extensions view: View → Extensions or press Ctrl+Shift+X (Windows/Linux) or ⌘⇧X (macOS)
Search for and install one of these extensions:
Follow the extension-specific instructions to:
Useful ADB Commands:
# List connected devices
adb devices
# Kill and restart ADB server (if device not detected)
adb kill-server
adb start-server
# Filter logs by multiple tags
adb logcat -s Uno:D Microsoft:D AndroidRuntime:E
# View logs with timestamps
adb logcat -v time
# View logs with thread IDs
adb logcat -v threadtime
# Follow logs in real-time with color (Linux/macOS)
adb logcat -v color
# Clear logs and start fresh
adb logcat -c && adb logcat
Tips for Effective Filtering:
Use grep (Linux/macOS) or findstr/Select-String (Windows) to filter output:
# Linux/macOS
adb logcat | grep -i "exception"
# Windows Command Prompt
adb logcat | findstr "exception"
# Windows PowerShell
adb logcat | Select-String "exception"
Enable Verbose Uno Logging:
Add or modify this code to your App.xaml.cs constructor to increase Uno-specific logging detail:
using Microsoft.Extensions.Logging;
public App()
{
#if __ANDROID__
var factory = Microsoft.Extensions.Logging.LoggerFactory.Create(builder =>
{
builder.AddConsole();
builder.SetMinimumLevel(LogLevel.Trace);
builder.AddFilter("Uno", LogLevel.Trace);
builder.AddFilter("Windows", LogLevel.Trace);
builder.AddFilter("Microsoft", LogLevel.Trace);
});
Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory = factory;
global::Uno.UI.Adapter.Microsoft.Extensions.Logging.LoggingAdapter.Initialize();
#endif
this.InitializeComponent();
}
Key Search Terms for Logcat:
When analyzing logs, search for these keywords to quickly identify issues:
Exception - Catch any exceptions thrownError - Application errorsCrash - Fatal crashesAndroidRuntime - Native Android runtime errorsFATAL EXCEPTION - Critical app crashesUno - Uno Platform-specific logsMicrosoft.UI.Xaml - WinUI/XAML-related logsmono-rt - Mono runtime messagesUno-Specific Log Tags:
Filter for these tags to focus on Uno Platform logs:
Uno.* - All Uno-related logsWindows.UI.Xaml - XAML framework logsMicrosoft.UI.Xaml - WinUI framework logsUnoViewGroup - Android view hierarchy logsUno.UI.Controls - Control-specific logsBest Practices When Reporting Issues:
Clear old logs:
adb logcat -c
Reproduce the issue immediately after clearing logs
Capture logs during the issue:
adb logcat > issue-reproduction.txt
Filter to relevant logs before sharing:
Include essential context:
Additional Resources:
Yowza, that’s a big file Try again with a file smaller than 10MB. -- GitHub
If you get the above message when attempting to upload the zipped sample, thats usually because you have included, beside the source codes, needless build outputs inside bin and obj folders for each target heads.
You can usually reduce this by performing Build > Clean Solution before zipping the entire solution folder. It also helps to manually delete the bin\ and obj\ folders under each project heads that you've compiled.
However, sometimes that still may not be enough. In such case, you can leverage the git tool and a .gitignore file to further reduce the size of the solution.
If you're inside of Visual Studio:
git clean -fdxOnce done, you can zip the folder and send it to GitHub in your issue or discussion.
Using the command prompt:
dotnet new gitignoregit initgit add .git commit -m "Initial sample commit"git archive HEAD --format zip --output sample.zipexplorer /select,sample.zipOnce done, you can send the sample.zip to GitHub in your issue or discussion.
Using a terminal:
wget https://raw.githubusercontent.com/github/gitignore/main/VisualStudio.gitignore -O .gitignoregit initgit add .git commit -m "Initial sample commit"git clean -fdxOnce done, you can zip the folder and send it to GitHub in your issue or discussion.