Commit f9b311b
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could <a
href="https://github.com/dotnet/maui/wiki/Testing-PR-Builds">test the
resulting artifacts</a> from this PR and let us know in a comment if
this change resolves your issue. Thank you!
This reverts the `BindableObject` micro-optimization changes from PR
#33584 on `release/10.0.1xx-sr8` due to regression risk. The revert
restores the previous property-context storage/access behavior and
removes the `InternalId` path added in that PR.
- **BindableObject revert (Controls.Core)**
- Restore `_properties` to `Dictionary<BindableProperty,
BindablePropertyContext>`.
- Remove `CollectionsMarshal`-based lookup/add path and `NETSTANDARD`
split logic.
- Restore `CreateAndAddContext` behavior (`_properties.Add(property,
context)`).
- Revert `GetContext` and `GetValues<T>` to `BindableProperty`-keyed
lookups.
- Restore `GetLocalValueEnumerator()`, `LocalValueEnumerator`, and
`LocalValueEntry`.
- **BindableProperty revert (Controls.Core)**
- Remove `InternalId` infrastructure:
- `using System.Threading`
- `_nextInternalId`
- `InternalId` field
- `Interlocked.Increment(...)` assignment in constructor
- **Benchmark cleanup**
- Remove
`src/Core/tests/Benchmarks/Benchmarks/BindableObjectBenchmarker.cs`
introduced by PR #33584.
- **Regression tests added (Controls.Core.UnitTests)**
- Add `GetValuesReturnsSetStateAndValue` to validate `GetValues<T>`
preserves expected set-state/value semantics for set vs unset
properties.
- Add `LocalValueEnumeratorReturnsLocallySetValues` to validate the
restored local value enumeration path (`GetLocalValueEnumerator` /
`LocalValueEntry`) over locally set values.
- Add
`DefaultValueCreatorCachesValueWhenReentrantPropertyAddsResizeStore` to
validate re-entrant `DefaultValueCreator` execution (including
additional property sets that grow the backing store) still caches the
created value and invokes the creator once.
Example of restored lookup path:
```csharp
readonly Dictionary<BindableProperty, BindablePropertyContext> _properties =
new Dictionary<BindableProperty, BindablePropertyContext>(4);
internal BindablePropertyContext GetContext(BindableProperty property) =>
_properties.TryGetValue(property, out var result) ? result : null;
BindablePropertyContext GetOrCreateContext(BindableProperty property) =>
GetContext(property) ?? CreateAndAddContext(property);
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
1 parent a11840b commit f9b311b
4 files changed
Lines changed: 152 additions & 72 deletions
File tree
- src
- Controls
- src/Core
- tests/Core.UnitTests
- Core/tests/Benchmarks/Benchmarks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
176 | 218 | | |
177 | 219 | | |
178 | | - | |
| 220 | + | |
179 | 221 | | |
180 | 222 | | |
181 | 223 | | |
182 | 224 | | |
183 | | - | |
184 | | - | |
| 225 | + | |
185 | 226 | | |
186 | 227 | | |
187 | | - | |
188 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
189 | 235 | | |
190 | 236 | | |
191 | 237 | | |
| |||
716 | 762 | | |
717 | 763 | | |
718 | 764 | | |
719 | | - | |
| 765 | + | |
720 | 766 | | |
721 | 767 | | |
722 | 768 | | |
| |||
725 | 771 | | |
726 | 772 | | |
727 | 773 | | |
| 774 | + | |
728 | 775 | | |
729 | 776 | | |
730 | 777 | | |
731 | 778 | | |
732 | | - | |
| 779 | + | |
733 | 780 | | |
734 | 781 | | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
| 782 | + | |
753 | 783 | | |
754 | 784 | | |
755 | 785 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
182 | 181 | | |
183 | 182 | | |
184 | 183 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 184 | | |
189 | 185 | | |
190 | 186 | | |
| |||
195 | 191 | | |
196 | 192 | | |
197 | 193 | | |
198 | | - | |
199 | | - | |
200 | 194 | | |
201 | 195 | | |
202 | 196 | | |
| |||
Lines changed: 94 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1564 | 1564 | | |
1565 | 1565 | | |
1566 | 1566 | | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
1567 | 1661 | | |
1568 | 1662 | | |
1569 | 1663 | | |
| |||
Lines changed: 0 additions & 38 deletions
This file was deleted.
0 commit comments