-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
DataContext value in DevTools displayed as null if type of value inherited from System.ComponentModel.Component #15877
Comments
The type to text ultimately goes through: Avalonia/src/Avalonia.Diagnostics/Diagnostics/Views/PropertyValueEditorView.cs Lines 345 to 355 in 9be975b
So the fix is probably to add another special case to the if (!converter.CanConvertTo(typeof(string)) ||
converter.GetType() == typeof(CollectionConverter) ||
converter.GetType() == typeof(ComponentConverter))
return o.ToString(); I can PR if this seems reasonable to a maintainer. I'm not familiar with |
Maybe it should just fallback to return converter.ConvertToInvariantString(o) ?? o.ToString(); or if (!converter.CanConvertTo(typeof(string)) ||
converter.GetType() == typeof(CollectionConverter) ||
converter.ConvertToInvariantString(o) is not { } converted)
return o.ToString();
return converted; |
I misdiagnosed because this is a bit nonsensical. Even simpler, you can repro with Explicit |
Describe the bug
Hello!
When ViewModel is inherited from System.ComponentModel.Component, it displays in DataContext value of DevTools.
But in debug DataContext has value.
To Reproduce
https://github.com/BreakByBrick/Avalonia.Issue/tree/main/DevTools.DataContextWithComponentDisplaysNull
Expected behavior
The DataContext value in DevTools must not be null.
Avalonia version
11.0.10
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: