Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 26, 2025

GitHub Issue: closes #18515

PR Type:

📚 Documentation content changes

What is the current behavior? 🤔

The "How to Create a Repro" documentation lacks Android-specific Logcat setup and access instructions, making it difficult for developers to debug Android issues and capture proper logs when reporting bugs.

What is the new behavior? 🚀

Adds comprehensive "Android Debugging with Logcat" section with IDE-specific instructions:

Visual Studio

  • Device Log window access and filtering by process/log level
  • Log management (clear, pause, copy, save)

JetBrains Rider

  • Logcat tool window with keyboard shortcuts (Alt+6/⌘6)
  • Regex filtering and log export
  • Android SDK configuration prerequisites

VS Code

  • Option 1: Manual ADB via terminal with command examples
    # Filter by app package
    adb logcat | grep "com.yourcompany.yourapp"
    
    # Filter by priority and tag
    adb logcat Uno:D *:E
    
    # Save to file
    adb logcat > android-logs.txt
  • Option 2: VS Code extensions (Android, ADB Interface, Android iOS Emulator)
  • Platform-specific filtering (grep, findstr, Select-String)

Common Tips

  • Enable verbose Uno logging:
    using Microsoft.Extensions.Logging;
    
    public App()
    {
    #if __ANDROID__
        Uno.UI.Adapter.Microsoft.Extensions.Logging.LoggingAdapter.MinimumLevel = LogLevel.Trace;
    #endif
        this.InitializeComponent();
    }
  • Key search terms: Exception, AndroidRuntime, FATAL EXCEPTION, Uno, mono-rt
  • Uno-specific log tags: Uno.*, Windows.UI.Xaml, UnoViewGroup
  • Best practices for capturing and reporting logs
  • Links to Android Logcat docs, Uno logging guide, ADB reference

Also adds cross-reference link from the debugging tips section (line 34) to the new Logcat section.

PR Checklist ✅

  • 📝 Commits follow Conventional Commits specification
  • 🧪 Not applicable (documentation only)
  • 📚 Documentation added
  • 🖼️ Not applicable (documentation only)
  • ❗ Contains NO breaking changes

Other information ℹ️

Related to #21977. All markdown syntax validated: 8 balanced code block pairs, 6 properly formatted tab sections.

Original prompt

Summary

Add comprehensive Logcat setup and access instructions for Android debugging across VS Code, JetBrains Rider, and Visual Studio to the "How to Create a Repro" documentation.

What

This change adds a new "Android Debugging with Logcat" section to doc/articles/uno-howto-create-a-repro.md with:

  • IDE-specific tabs for Visual Studio, Rider, and VS Code
  • Step-by-step Logcat access instructions for each IDE
  • VS Code setup with both manual ADB and extension options
  • Common filtering tips and best practices
  • Code examples for enabling verbose Uno logging
  • Cross-reference from the debugging tips section

Why

The existing documentation lacks essential Logcat setup instructions, making it difficult for developers to debug Android issues when creating reproducible examples. This is especially important for:

  • New developers getting started with Uno Platform on Android
  • Creating high-quality bug reports with proper logs
  • Debugging Android-specific issues across different IDEs

Which issue

Fixes #18515

Related to #21977

Changes Required

1. Update doc/articles/uno-howto-create-a-repro.md

Insert after line 41 (in the debugging tips section):

Add a new section titled "## Android Debugging with Logcat" with three IDE-specific tabs:

Visual Studio Tab

  • Accessing the Device Log window
  • Filtering by process name, log level, and search terms
  • Tips for clearing, pausing, copying, and saving logs

Rider Tab

  • Accessing the Logcat tool window
  • Using log level filters and regex patterns
  • Keyboard shortcuts and export options
  • Prerequisites for Android SDK configuration

VS Code Tab

  • Prerequisites: Android SDK installation and ADB verification
  • Option 1: Using Terminal with manual ADB commands including:
    • Basic logcat commands
    • Filtering by package name, priority, and tags
    • Saving logs to file
  • Option 2: Using VS Code extensions (Android, ADB Interface, Android iOS Emulator)
  • Useful ADB command reference with examples
  • Tips for effective filtering with grep/findstr

Common Tips Section (All IDEs)

  • Code example for enabling verbose Uno logging in App.xaml.cs
  • Key search terms for Logcat (Exception, Error, Crash, AndroidRuntime, etc.)
  • Uno-specific log tags to filter on
  • Best practices when reporting issues:
    • Clear old logs
    • Reproduce the issue
    • Capture and filter relevant logs
    • Include essential context
  • Links to additional resources (Android Logcat docs, Uno logging guide, ADB reference)

Update line 36 to add cross-reference:
Change the bullet point about analyzing logs to include:

- Analyze device and app logs for clues about the control's behavior. For Android-specific logging, see [Android Debugging with Logcat](#android-debugging-with-logcat) below.

Complete Section Content

## Android Debugging with Logcat

When debugging Android-specific issues, Logcat provides essential device and application logs. Here's how to access Logcat in different development environments:

### [**Visual Studio**](#tab/vs)

Visual Studio provides built-in Logcat support through the **Device Log** window.

**Accessing Logcat:**
1. Deploy your app to an Android device or emulator
2. Navigate to **View****Other Windows****Device Log**
3. Select your target device from the dropdown menu
4. The logs will automatically stream from the selected device

**Filtering Logs:**
- Filter by **Process Name**: Enter your app's package name
- Filter by **Log Level**: Choose from Verbose, Debug, Info, Warn, Error, or Fatal
- Use the **Search box** to find specific terms like "Uno", "Exception", or error messages
- Click the **Filter** dropdown to apply multiple filters simultaneously

**Useful Tips:**
- Right-click in the Device Log window and select **Clear All** before reproducing an issue for cleaner logs
- Use the **Pause** button in the toolbar to freeze log output for easier reading
- Select relevant log entries, right-click, and choose **Copy** to share specific logs
- Save logs via the toolbar save button for later analysis

### [**JetBrains Rider**](#tab/rider)

Rider provides Logcat access through the **Logcat** tool window with advanced filtering capabilities.

**Accessing Logcat:**
1. Deploy your app to an Android device or emulator
2. Navigate to **View****Tool Windows****Logcat**
   - Alternatively, press **Alt+6** (Windows/Linux) or **⌘6** (macOS)
3. Select your device from the device dropdown in the toolbar
4. Select your app's process from the process filter dropdown

**Filtering and Searching:**
- Use the **log level filter** buttons in the toolbar (Verbose, Debug, Info, Warn, Error, Assert)
- Enter search terms in the **filter bar** at the top
- Use **regex patterns** for advanced filtering (e.g., `Uno.*Exception`)
- Click the **filter settings** icon to configure column visibility and formatting

**U...

</details>

*This pull request was created as a result of the following prompt from Copilot chat.*
> ## Summary
> 
> Add comprehensive Logcat setup and access instructions for Android debugging across VS Code, JetBrains Rider, and Visual Studio to the "How to Create a Repro" documentation.
> 
> ## What
> 
> This change adds a new "Android Debugging with Logcat" section to `doc/articles/uno-howto-create-a-repro.md` with:
> - IDE-specific tabs for Visual Studio, Rider, and VS Code
> - Step-by-step Logcat access instructions for each IDE
> - VS Code setup with both manual ADB and extension options
> - Common filtering tips and best practices
> - Code examples for enabling verbose Uno logging
> - Cross-reference from the debugging tips section
> 
> ## Why
> 
> The existing documentation lacks essential Logcat setup instructions, making it difficult for developers to debug Android issues when creating reproducible examples. This is especially important for:
> - New developers getting started with Uno Platform on Android
> - Creating high-quality bug reports with proper logs
> - Debugging Android-specific issues across different IDEs
> 
> ## Which issue
> 
> Fixes https://github.com/unoplatform/uno/issues/18515
> 
> Related to https://github.com/unoplatform/uno/issues/21977
> 
> ## Changes Required
> 
> ### 1. Update `doc/articles/uno-howto-create-a-repro.md`
> 
> **Insert after line 41** (in the debugging tips section):
> 
> Add a new section titled "## Android Debugging with Logcat" with three IDE-specific tabs:
> 
> #### Visual Studio Tab
> - Accessing the Device Log window
> - Filtering by process name, log level, and search terms
> - Tips for clearing, pausing, copying, and saving logs
> 
> #### Rider Tab  
> - Accessing the Logcat tool window
> - Using log level filters and regex patterns
> - Keyboard shortcuts and export options
> - Prerequisites for Android SDK configuration
> 
> #### VS Code Tab
> - Prerequisites: Android SDK installation and ADB verification
> - **Option 1**: Using Terminal with manual ADB commands including:
>   - Basic logcat commands
>   - Filtering by package name, priority, and tags
>   - Saving logs to file
> - **Option 2**: Using VS Code extensions (Android, ADB Interface, Android iOS Emulator)
> - Useful ADB command reference with examples
> - Tips for effective filtering with grep/findstr
> 
> #### Common Tips Section (All IDEs)
> - Code example for enabling verbose Uno logging in `App.xaml.cs`
> - Key search terms for Logcat (Exception, Error, Crash, AndroidRuntime, etc.)
> - Uno-specific log tags to filter on
> - Best practices when reporting issues:
>   - Clear old logs
>   - Reproduce the issue
>   - Capture and filter relevant logs
>   - Include essential context
> - Links to additional resources (Android Logcat docs, Uno logging guide, ADB reference)
> 
> **Update line 36** to add cross-reference:
> Change the bullet point about analyzing logs to include:
> ```markdown
> - Analyze device and app logs for clues about the control's behavior. For Android-specific logging, see [Android Debugging with Logcat](#android-debugging-with-logcat) below.
> ```
> 
> ## Complete Section Content
> 
> ````markdown
> ## Android Debugging with Logcat
> 
> When debugging Android-specific issues, Logcat provides essential device and application logs. Here's how to access Logcat in different development environments:
> 
> ### [**Visual Studio**](#tab/vs)
> 
> Visual Studio provides built-in Logcat support through the **Device Log** window.
> 
> **Accessing Logcat:**
> 1. Deploy your app to an Android device or emulator
> 2. Navigate to **View** → **Other Windows** → **Device Log**
> 3. Select your target device from the dropdown menu
> 4. The logs will automatically stream from the selected device
> 
> **Filtering Logs:**
> - Filter by **Process Name**: Enter your app's package name
> - Filter by **Log Level**: Choose from Verbose, Debug, Info, Warn, Error, or Fatal
> - Use the **Search box** to find specific terms like "Uno", "Exception", or error messages
> - Click the **Filter** dropdown to apply multiple filters simultaneously
> 
> **Useful Tips:**
> - Right-click in the Device Log window and select **Clear All** before reproducing an issue for cleaner logs
> - Use the **Pause** button in the toolbar to freeze log output for easier reading
> - Select relevant log entries, right-click, and choose **Copy** to share specific logs
> - Save logs via the toolbar save button for later analysis
> 
> ### [**JetBrains Rider**](#tab/rider)
> 
> Rider provides Logcat access through the **Logcat** tool window with advanced filtering capabilities.
> 
> **Accessing Logcat:**
> 1. Deploy your app to an Android device or emulator
> 2. Navigate to **View** → **Tool Windows** → **Logcat**
>    - Alternatively, press **Alt+6** (Windows/Linux) or **⌘6** (macOS)
> 3. Select your device from the device dropdown in the toolbar
> 4. Select your app's process from the process filter dropdown
> 
> **Filtering and Searching:**
> - Use the **log level filter** buttons in the toolbar (Verbose, Debug, Info, Warn, Error, Assert)
> - Enter search terms in the **filter bar** at the top
> - Use **regex patterns** for advanced filtering (e.g., `Uno.*Exception`)
> - Click the **filter settings** icon to configure column visibility and formatting
> 
> **Useful Tips:**
> - Right-click in the Logcat window and select **Clear** to remove previous logs
> - Use **Ctrl+F** (Windows/Linux) or **⌘F** (macOS) to open the find dialog for searching within logs
> - Export logs using **Right-click** → **Export to Text File**
> - Configure log colors in **File** → **Settings** → **Editor** → **Color Scheme** → **Logcat**
> 
> **Prerequisites:**
> - Ensure Android SDK is configured: **File** → **Settings** → **Appearance & Behavior** → **System Settings** → **Android SDK**
> - Verify ADB connection by checking if your device appears in the device dropdown
> - If the device doesn't appear, run `adb devices` in the terminal to troubleshoot
> 
> ### [**VS Code**](#tab/vscode)
> 
> VS Code requires manual ADB setup or extensions for Logcat viewing.
> 
> **Prerequisites:**
> 1. **Install Android SDK** (if not already installed):
>    - Windows: Typically located at `C:\Users\<username>\AppData\Local\Android\Sdk`
>    - macOS: `~/Library/Android/sdk`
>    - Linux: `~/Android/Sdk`
> 
> 2. **Verify ADB Installation:**
>    - ADB is located in `<Android-SDK>/platform-tools/adb`
>    - Add ADB to your system PATH or note its full path
>    - Test by running: `adb version`
> 
> **Option 1: Using Terminal (Manual ADB)**
> 
> 1. Open VS Code's integrated terminal: **View** → **Terminal** or press **Ctrl+`** (Windows/Linux) or **⌘`** (macOS)
> 2. Ensure your device or emulator is running and connected
> 3. Verify device connection:
>    ```bash
>    adb devices
>    ```
> 4. Start viewing logs:
>    ```bash
>    # View all logs (verbose)
>    adb logcat
>    
>    # Clear previous logs first
>    adb logcat -c
>    
>    # Filter by your app's package name
>    adb logcat | grep "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
>    ```
> 
> **Option 2: Using VS Code Extensions**
> 
> 1. Open the Extensions view: **View** → **Extensions** or press **Ctrl+Shift+X** (Windows/Linux) or **⌘⇧X** (macOS)
> 2. Search for and install one of these extensions:
>    - **"Android"** by adelphes
>    - **"ADB Interface for VSCode"** by vincenthage
>    - **"Android iOS Emulator"** by DiemasMichiels
> 3. Follow the extension-specific instructions to:
>    - Configure the Android SDK path in VS Code settings
>    - Open the Logcat view (usually in the sidebar or via command palette)
>    - Connect to your device/emulator
> 
> **Useful ADB Commands:**
> 
> ```bash
> # 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` (Windows) to filter output:
>   ```bash
>   # Linux/macOS
>   adb logcat | grep -i "exception"
>   
>   # Windows PowerShell
>   adb logcat | Select-String "exception"
>   ```
> 
> ---
> 
> ### Common Logcat Tips (All IDEs)
> 
> **Enable Verbose Uno Logging:**
> 
> Add this code to your `App.xaml.cs` constructor to increase Uno-specific logging detail:
> 
> ```csharp
> #if __ANDROID__
> using Microsoft.Extensions.Logging;
> 
> public App()
> {
>     // Enable verbose logging for Uno Platform
>     Uno.UI.Adapter.Microsoft.Extensions.Logging.LoggingAdapter.MinimumLevel = LogLevel.Trace;
>     
>     this.InitializeComponent();
> }
> #endif
> ```
> 
> **Key Search Terms for Logcat:**
> 
> When analyzing logs, search for these keywords to quickly identify issues:
> - `Exception` - Catch any exceptions thrown
> - `Error` - Application errors
> - `Crash` - Fatal crashes
> - `AndroidRuntime` - Native Android runtime errors
> - `FATAL EXCEPTION` - Critical app crashes
> - `Uno` - Uno Platform-specific logs
> - `Microsoft.UI.Xaml` - WinUI/XAML-related logs
> - `mono-rt` - Mono runtime messages
> 
> **Uno-Specific Log Tags:**
> 
> Filter for these tags to focus on Uno Platform logs:
> - `Uno.*` - All Uno-related logs
> - `Windows.UI.Xaml` - XAML framework logs
> - `Microsoft.UI.Xaml` - WinUI framework logs
> - `UnoViewGroup` - Android view hierarchy logs
> - `Uno.UI.Controls` - Control-specific logs
> 
> **Best Practices When Reporting Issues:**
> 
> 1. **Clear old logs:**
>    ```bash
>    adb logcat -c
>    ```
> 
> 2. **Reproduce the issue** immediately after clearing logs
> 
> 3. **Capture logs** during the issue:
>    ```bash
>    adb logcat > issue-reproduction.txt
>    ```
> 
> 4. **Filter to relevant logs** before sharing:
>    - Focus on the timeframe when the issue occurred
>    - Include 10-20 lines before and after the error
>    - Remove sensitive information (API keys, user data, etc.)
> 
> 5. **Include essential context:**
>    - Uno Platform version
>    - Android version and device/emulator details
>    - Steps to reproduce
>    - Expected vs actual behavior
> 
> **Additional Resources:**
> - [Android Logcat Documentation](https://developer.android.com/studio/command-line/logcat)
> - [Uno Platform Logging Guide](xref:Uno.Development.Logging)
> - [ADB Command Reference](https://developer.android.com/studio/command-line/adb)
> 
> ---
> ````
> 
> ## Formatting Requirements
> 
> - Use the existing tab structure format consistent with the rest of the document
> - Maintain proper markdown syntax for headers, code blocks, and lists
> - Ensure code blocks use appropriate language syntax (bash, csharp)
> - Follow the document's existing spacing and indentation patterns
> 
> ## Testing
> 
> The PR should ensure:
> - Markdown renders correctly in the docs site
> - Tab navigation works between IDE sections
> - All ADB commands are accurate
> - Code examples have proper syntax highlighting
> - All links are valid
> - Follows existing documentation formatting
> 
> ## Commit Message
> 
> ```
> docs: Add Logcat setup instructions for VS Code, Rider, and Visual Studio
> 
> - Add comprehensive Android Logcat access guide for three IDEs
> - Include step-by-step setup for VS Code with manual ADB and extensions
> - Document Logcat access in Rider and Visual Studio
> - Add common filtering tips and best practices
> - Include code examples for enabling verbose Uno logging
> 
> Fixes https://github.com/unoplatform/uno/issues/18515
> ```
> 

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Add Logcat setup and access instructions for Android debugging docs: Add comprehensive Logcat setup and debugging instructions for Android Nov 26, 2025
Copilot AI requested a review from Jen-Uno November 26, 2025 21:42
Copilot finished work on behalf of Jen-Uno November 26, 2025 21:42
@unodevops
Copy link
Contributor

⚠️⚠️ The build 185284 has failed on Uno.UI - docs.

@Jen-Uno Jen-Uno marked this pull request as ready for review November 27, 2025 17:22
Copilot AI review requested due to automatic review settings November 27, 2025 17:22
Copilot finished reviewing on behalf of Jen-Uno November 27, 2025 17:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +206 to +218
```csharp
using Microsoft.Extensions.Logging;

public App()
{
#if __ANDROID__
// Enable verbose logging for Uno Platform
Uno.UI.Adapter.Microsoft.Extensions.Logging.LoggingAdapter.MinimumLevel = LogLevel.Trace;
#endif

this.InitializeComponent();
}
```
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code example references a non-existent API LoggingAdapter.MinimumLevel. Based on the actual implementation in src/Uno.UI.Adapter.Microsoft.Extensions.Logging/LoggingAdapter.cs and usage patterns in src/SamplesApp/SamplesApp.Shared/App.xaml.cs (lines 454-540), the correct way to configure Uno Platform logging is:

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();
}

This follows the standard Microsoft.Extensions.Logging configuration pattern used throughout the codebase.

Copilot uses AI. Check for mistakes.
@Jen-Uno Jen-Uno requested a review from agneszitte November 27, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] Missing Logcat Setup/Details documentation for VS Code, Rider, and Visual Studio

4 participants