InlineUIContainer crashes the program if parent TextBlock spawns with `IsVisible="False"`
Author: kevinrmartinezCreated Sep 28, 2026Updated Sep 29, 2026
Labelsbug
Describe the bug
The combination of a TextBlock with IsVisible="False" while holding a InlineUIContainer (to hold a HyperlinkButton in this case) raises an exception during run-time and design time:
InvalidOperationException: Visual was invalidated during the render passThe view holding the offending control won't load. If the exception is forcefully handled, the UI will hang/freeze.
To Reproduce
By creating a simple program with the following content:
<TextBlock TextWrapping="Wrap" IsVisible="False">
<Run Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/>
<InlineUIContainer BaselineAlignment="TextBottom">
<HyperlinkButton Margin="0" Padding="0" Content="This is a Link" NavigateUri="https://docs.avaloniaui.net/docs/app-development/setting-unhandled-exceptions"/>
</InlineUIContainer>
</TextBlock>Expected behavior
The TextBlock to be not visible while the program keeps running.
Avalonia version
12.1.3
OS
Linux
Additional context
If the value of IsVisible is set in the View's constructor on code-behind, no exception is raised.
Source: AvaloniaUI/Avalonia