New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Putting RoutedViewHost inside a TabControl on Avalonia causes an app crash after navigating the second time #3680
Comments
We've resolved this issue by copying the this.WhenActivated(disposables =>
{
....
Disposable.Create(() =>
{
Content = null;
})
.DisposeWith(disposables);
}); This resolves the root cause of the issue. The problem is that once the view is reactivated, the same content is recreated through view location. However, that view is already attached to the parent. This means whenever the routed view host deactivates, we also need to clear its content. Otherwise, we are risking double-attaching the same view and causing this exception. |
Probably worth raising this up with the Avalonia team. See if you can get the fix in. |
@glennawatson you are actually right. I've extended the sample I've attached to this bug report. And instead of using |
Closing this issue for the time being, for 2 reasons
|
Worth noting that AvaloniaUI own both the RoutedViewHost and the TransitioningContentControl https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.ReactiveUI/RoutedViewHost.cs So bugs with that system aren't necessarily related directly with ReactiveUI. |
@glennawatson thanks for the info, I actually didn't realize that. And the good news is the issue is already fixed in the latest CI beta release. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug 🐞
I have the following scenario
TabControl
with 2 tabs - Companies and EmployeesRoutedViewHost
Step to reproduce
Employees
Companies
Reproduction repository
https://github.com/kyurkchyan/RoutedViewHostInsideTabControl
Expected behavior
The tab switching should work seamlessly
Screenshots 🖼️
No response
IDE
Rider macOS
Operating system
Mac OS 14.0 (23A344)
Version
Avalonia.ReactiveUI 11.0.5
Device
Mac
ReactiveUI Version
19.5.1
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered: