-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[X] remove IElementNode interface #31559
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request removes the IElementNode interface which was identified as a premature optimization from 10 years ago. The goal is to revert this abstraction while there aren't too many conflicting branches, simplifying the codebase by directly using the ElementNode class instead of the interface.
- Removes the
IElementNodeinterface entirely from the XAML node hierarchy - Updates all references to use
ElementNodedirectly instead ofIElementNode - Modernizes code with C# language features (primary constructors, collection expressions, pattern matching improvements)
Reviewed Changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| XamlNode.cs | Removes IElementNode interface, updates ElementNode to implement interfaces directly |
| XmlName.cs | Converts to modern C# syntax with readonly struct and primary constructor |
| Multiple visitor files | Updates type references from IElementNode to ElementNode throughout the codebase |
| Test files | Removes mock IElementNode implementations that are no longer needed |
| #if NETSTANDARD2_0 | ||
| if (NamespaceURI != null) | ||
| hashCode = NamespaceURI.GetHashCode(); | ||
| if (LocalName != null) | ||
| hashCode = (hashCode * 397) ^ LocalName.GetHashCode(); | ||
| int hashCode = 0; | ||
| if (NamespaceURI != null) | ||
| hashCode = NamespaceURI.GetHashCode(); | ||
| if (LocalName != null) | ||
| hashCode = (hashCode * 397) ^ LocalName.GetHashCode(); | ||
| return hashCode; | ||
| #else | ||
| if (NamespaceURI != null) | ||
| hashCode = NamespaceURI.GetHashCode(StringComparison.Ordinal); | ||
| if (LocalName != null) | ||
| hashCode = (hashCode * 397) ^ LocalName.GetHashCode(StringComparison.Ordinal); | ||
| return HashCode.Combine(NamespaceURI, LocalName); | ||
| #endif |
Copilot
AI
Sep 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NETSTANDARD2_0 conditional compilation removes the use of StringComparison.Ordinal that was present in the original code. This could lead to culture-sensitive hash code generation on .NET Standard 2.0, potentially causing issues with hash table operations across different cultures.
that was a premature optimization 10 years ago, revert that while we don't have too many conflicting branches
6888f5d to
4e76f37
Compare
Co-authored-by: Šimon Rozsíval <simon@rozsival.com>
Co-authored-by: Šimon Rozsíval <simon@rozsival.com>
Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
that was a premature optimization 10 years ago, revert that while we don't have too many conflicting branches