Skip to content
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

TreeView crashes when using TemplateSelector and loading certain amount of nodes #8791

Closed
ADD-Lorenzo-Martin opened this issue Aug 28, 2023 · 4 comments
Labels
area-TreeView bug Something isn't working closed-Duplicate Described behavior is already captured by another issue. team-Controls Issue for the Controls team

Comments

@ADD-Lorenzo-Martin
Copy link

Describe the bug

When adding a TemplateSelector to a TreeView with several different templates, after loading the TreeView with an ItemsSource with a certain number of elements, the App will crash complaining of an exception when trying to cast the ViewModel bount to a node.

It seems like it is trying to reuse a node but if it was bound formerly to a specific viewmodel type, and later it is bound to another type, it still tries to cast the current viewmodel to the other one's type.

A sample App is supplied.
WinUITreeviewErrors.zip

Steps to reproduce the bug

Launch the sample application and it should crash.

Expected behavior

Being able to have an items source for a TreeView, with any amount of elements of several types that should be represented through a Template selector without crashing.

Screenshots

The exception shown after launching the sample Application:

TreeViewCrash

NuGet package version

None

Windows version

No response

Additional context

No response

@ADD-Lorenzo-Martin ADD-Lorenzo-Martin added the bug Something isn't working label Aug 28, 2023
@ADD-Lorenzo-Martin
Copy link
Author

This issue is related to #7618 that was closed recently by the bot without being solved.

@fabianoriccardi
Copy link

Before any bot thinks that this is issue should be closed for inactivity, I can confirm that this issue is still valid in WASDK 1.5.5. In particular, I have just downloaded and update all the deps in the example provided by @ADD-Lorenzo-Martin. It compiles, but it crashes immediately at startup.

For curiosity, I have tried to change the abstract class TreeNodeViewModelBase into a non-abstract class (and make the changes to make it compile), but it crashes for the same reason at startup.

@llongley llongley closed this as not planned Won't fix, can't repro, duplicate, stale Aug 13, 2024
@llongley llongley added the closed-Duplicate Described behavior is already captured by another issue. label Aug 13, 2024
@ADD-Lorenzo-Martin
Copy link
Author

@llongley Could you please tell me the issue number where this issue is going to be treated, in order to follow it. I see another closed issue where this one was mentioned (#7618)

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Aug 13, 2024
@codendone
Copy link
Contributor

@ADD-Lorenzo-Martin Looking at the internal bug, this was resolved as duplicate of #2121.

@codendone codendone removed the needs-triage Issue needs to be triaged by the area owners label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TreeView bug Something isn't working closed-Duplicate Described behavior is already captured by another issue. team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

5 participants