Debugging a mobile application is different from debugging a normal desktop application. When a problem happens on a physical Android or iOS device, you often need to understand what the application is doing while it is running instead of relying only on source code and log messages.
.NET MAUI provides a cross-platform development model, but that does not remove the need for runtime inspection. A page can have the wrong layout, a binding can fail silently, a property can contain an unexpected value, or a UI interaction can trigger a problem that is difficult to reproduce from code alone.
DevFlow is designed to make this type of development workflow easier by providing runtime inspection capabilities for .NET MAUI applications. Instead of repeatedly stopping the application, changing code, rebuilding it, and launching it again just to understand the current UI state, developers can inspect the running application and use that information during debugging.
This article explains how the runtime inspection workflow works, what types of problems it can help diagnose, how to approach debugging with it, and where traditional debugging tools are still the better choice.
Why Runtime Inspection Matters in .NET MAUI
A typical .NET MAUI development cycle looks like this:
Change code
|
v
Build application
|
v
Deploy to device
|
v
Navigate to screen
|
v
Observe problem
|
v
Change code againThis cycle becomes expensive when the problem depends on the runtime state of the application.
For example, suppose a page contains a collection of products. The source code may look correct, but the device shows an empty list.
Several things could be responsible:
The collection may be empty.
The binding path may be incorrect.
The BindingContext may not be what you expect.
A property may contain null.
The page may be using a different view model instance.
A command may not be connected correctly.
The UI element may not be part of the visual tree you expect.
Looking only at the XAML file does not tell you which of these situations is happening.
Runtime inspection gives you another perspective: what the application actually looks like and contains while it is running.
What DevFlow Is Useful For
The most useful way to think about DevFlow is as a runtime development aid.
It can help you inspect application behavior without treating every debugging problem as a code-editing problem.
For a running .NET MAUI application, the inspection workflow can help developers understand areas such as:
The current visual hierarchy.
UI elements currently displayed on a page.
Runtime properties.
Layout and element relationships.
Application state during development.
Problems that only appear after navigation or user interaction.
This is especially useful when the source code and the rendered application do not appear to agree.
For example, you may have written:
<Label
Text="{Binding ProductName}"
FontSize="18" />The XAML is valid, but the label is empty.
Instead of immediately changing the XAML, inspect the running application and determine whether the element exists, whether its runtime state is what you expect, and whether the surrounding page has the correct data context.
That gives you a much narrower problem to investigate.
Start With a Running .NET MAUI Application
Runtime inspection is most useful when the application is already running on a supported development environment.
A simple MAUI page might look like this:
<ContentPage
x:Class="DemoApp.Pages.ProductPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<VerticalStackLayout Padding="20">
<Label
Text="{Binding ProductName}"
FontSize="24" />
<Label
Text="{Binding Description}"
FontSize="16" />
<Button
Text="Add to Cart"
Command="{Binding AddToCartCommand}" />
</VerticalStackLayout>
</ContentPage>The associated view model might contain:
public class ProductViewModel
{
public string ProductName { get; set; } = "Laptop";
public string Description { get; set; } =
"Development laptop";
public ICommand AddToCartCommand { get; }
}Everything can compile successfully while the application still behaves incorrectly.
This is one reason runtime inspection is valuable. Compilation proves that the code is syntactically and type-wise acceptable. It does not prove that the runtime UI contains the state you intended.
Inspecting the Visual Tree
One of the most useful debugging tasks in a UI application is understanding the visual tree.
Consider this hierarchy:
ContentPage
|
+-- Grid
|
+-- VerticalStackLayout
|
+-- Label
|
+-- Button
|
+-- CollectionViewIn a real application, the hierarchy can become much more complicated because of templates, navigation containers, custom controls, layouts, and platform-specific handlers.
When a control does not appear where expected, the visual hierarchy can help answer several questions.
Is the control actually present?
Is it inside the layout you expected?
Is another element covering it?
Is the parent layout receiving the expected size?
Is the control being generated inside a template?
These questions are often difficult to answer by reading XAML alone.
Finding Problems in Deep UI Hierarchies
Consider a page containing a CollectionView with a custom item template:
<CollectionView ItemsSource="{Binding Products}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="12">
<Label
Text="{Binding Name}"
FontSize="18" />
<Label
Text="{Binding Price}"
Grid.Row="1" />
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>If the price is not visible, the problem might not be the Label.
The item template could have an incorrect binding context. The collection might contain different objects than expected. The layout could also be affected by another element.
Runtime inspection allows you to investigate the generated UI rather than only the XAML template.
This is particularly useful for applications with complicated reusable controls.
Inspecting Runtime Properties
A UI element can have properties that differ from what you expect from the source code.
For example:
<Button
Text="Save"
IsEnabled="{Binding CanSave}" />You may expect the button to be enabled, but the running application shows it disabled.
Instead of changing the binding immediately, inspect the runtime state.
You want to determine:
Expected:
CanSave = true
IsEnabled = true
Actual:
CanSave = ?
IsEnabled = falseIf CanSave is false, the problem is probably in application state or view model logic.
If CanSave is true but the button remains disabled, the investigation moves toward binding, lifecycle, or UI behavior.
This distinction saves time because you are debugging the actual failure instead of guessing.
Runtime Inspection and Data Binding
Data binding is one of the areas where runtime inspection can be especially useful.
Consider:
<Label Text="{Binding UserName}" />There are several possible failure points.
The page may have no BindingContext:
BindingContext = null;The BindingContext may contain a different object:
BindingContext = new LoginViewModel();The property may be null:
public string? UserName { get; set; }Or the property may exist but not notify the UI when it changes.
For example:
public string UserName
{
get => _userName;
set
{
_userName = value;
OnPropertyChanged();
}
}If property notification is missing, changing the property may not update the UI.
Runtime inspection helps you determine which part of the chain is actually failing.
Inspecting Navigation Problems
Mobile applications frequently have multiple pages and navigation paths.
Join the conversation! Your thoughts help the community grow.