Commit b3068cc
🐛 Fix: Block inherited Add method on AppItemGroup (#305)
* Fix: shadow inherited Add method to prevent silent state corruption in AppItemGroup
Shadows the inherited `Add` method with `new void Add(AppItem item)` that throws `NotSupportedException`. This ensures callers trying to directly `Add` to an `AppItemGroup` are immediately blocked, protecting the internal collection and filter state as validated by existing unit tests.
* Fix: document why shadowed Add method coexists with InsertItem guard
Adds explanatory documentation directly above the `public new void Add` method in `AppItemGroup` to clarify its purpose. The comment highlights that while `InsertItem` effectively prevents mutations via virtual dispatch, the shadowed `Add` method provides an immediate failure explicitly at the `AppItemGroup` API boundary to prevent developers from accidentally bypassing the tracking mechanism by calling the method directly on the class.
* Update Models/AppItemGroup.cs
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Mike Knight <173126+mikekthx@users.noreply.github.com>1 parent 9739810 commit b3068cc
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
| |||
0 commit comments