-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing memory leaks of Numeric/DomainUpDown elements accessible objec…
…ts (#7330) Fixes #7328⚠️ Doesn't fix memory leaks of TextPattern. It will be fixed as another fix for TextBox as well. ## Proposed changes - Rework and refactor accessible objects implementation of UpDown controls. Removed `ItemList` and Item accessible objects, because they are unnecessary. Moved the implementation to the base class. [This comment](#4207 (comment)) describes why we don't keep ItemsList anymore. - Add a call of `UiaDisconnectProvider` for `Numeric/DomainUpDown` elements (its textbox and buttons) when the control is disposing. ## Customer Impact - Less memory leaks ## Regression? - No ## Risk - Minimal ## Screenshots <!-- Remove this section if PR does not change UI --> ### Before - There are some left objects in memory due to `UpDownEdit` and `UpDownButtons`: ![image](https://user-images.githubusercontent.com/49272759/174846510-c6be894d-d85d-43f0-b439-f52f93ca8991.png) ### After - Memory is clear after disposing: ![image](https://user-images.githubusercontent.com/49272759/174846839-57c3faa0-b76c-495f-8bd6-4a42d2d5bb38.png) ## Test methodology - CTI - Manual - Unit tests ## Accessibility testing - Using Narrator/Inspect and WinDbg ## Test environment(s) - .NET 7.0 Preview 4 - Windows 11
- Loading branch information
1 parent
4070954
commit eff830b
Showing
18 changed files
with
186 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# List of Diagnostics Produced by Windows Forms .NET APIs | ||
|
||
## Obsoletions | ||
|
||
Per https://github.com/dotnet/designs/blob/master/accepted/2020/better-obsoletion/better-obsoletion.md and similar to https://github.com/dotnet/runtime/blob/main/docs/project/list-of-diagnostics.md, we now have a strategy for marking existing APIs as `[Obsolete]`. This takes advantage of the new diagnostic id and URL template mechanisms introduced to `ObsoleteAttribute` in .NET 5. | ||
|
||
The diagnostic id values reserved for obsoletions are `WFDEV001` through `WFDEV999`. When obsoleting an API, claim the next three-digit identifier in the `WFDEV###` sequence and add it to the list below. The URL template for all obsoletions is `https://aka.ms/winforms-warnings/{0}`. The `{0}` placeholder is replaced by the compiler with the `WFDEV###` identifier. | ||
|
||
The acceptance criteria for adding an obsoletion includes: | ||
|
||
* Add the obsoletion to the table below, claiming the next diagnostic id | ||
* Ensure the description is meaningful within the context of this table, and without requiring the context of the calling code | ||
* Add new constants to `src\Common\src\Obsoletions.cs`, following the existing conventions | ||
* A `...Message` const using the same description added to the table below | ||
* A `...DiagnosticId` const for the `WFDEV###` id | ||
* Annotate `src` files by referring to the constants defined from `Obsoletions.cs` | ||
* Specify the `UrlFormat = Obsoletions.SharedUrlFormat` | ||
* Example: `[Obsolete(Obsoletions.DomainUpDownAccessibleObjectMessage, DiagnosticId = Obsoletions.DomainUpDownAccessibleObjectDiagnosticId, UrlFormat = Obsoletions.SharedUrlFormat)]` | ||
* If the `Obsoletions` type is not available in the project, link it into the project | ||
* `<Compile Include="..\..\Common\src\Obsoletions.cs" Link="Common\Obsoletions.cs" />` | ||
* Apply the `:book: documentation: breaking` label to the PR that introduces the obsoletion | ||
* Follow up with the breaking change process to communicate and document the breaking change | ||
* In the breaking-change issue filed in [dotnet/docs](https://github.com/dotnet/docs), specifically mention that this breaking change is an obsoletion with a `WFDEV` diagnostic id | ||
* The documentation team will produce a PR that adds the obsoletion to the [WFDEV warnings](https://docs.microsoft.com/dotnet/core/compatibility/winforms-obsoletions) page | ||
* That PR will also add a new URL specific to this diagnostic ID; e.g. [WFDEV001](https://docs.microsoft.com/dotnet/core/compatibility/winforms-warnings/WFDEV001) | ||
* Connect with `@gewarren` or `@BillWagner` with any questions | ||
* Register the `WFDEV###` URL in `aka.ms` | ||
* The vanity name will be `winforms-warnings/WFDEV###` | ||
* Ensure the link's group owner matches the group owner of `winforms-warnings/WFDEV001` | ||
* Connect with `@igveliko` or `@gewarren` with any questions | ||
|
||
### Obsoletion Diagnostics (`WFDEV001` - `WFDEV999`) | ||
|
||
| Diagnostic ID | Description | | ||
| :---------------- | :---------- | | ||
| __`WFDEV001`__ | Casting to/from IntPtr is unsafe, use `WParamInternal`. | | ||
| __`WFDEV001`__ | Casting to/from IntPtr is unsafe, use `LParamInternal`. | | ||
| __`WFDEV001`__ | Casting to/from IntPtr is unsafe, use `ResultInternal`. | | ||
| __`WFDEV002`__ | `DomainUpDown.DomainUpDownAccessibleObject` is no longer used to provide accessible support for `DomainUpDown` controls. | | ||
| __`WFDEV003`__ | `DomainUpDown.DomainItemAccessibleObject` is no longer used to provide accessible support for `DomainUpDown` items. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System; | ||
|
||
internal static class Obsoletions | ||
{ | ||
internal const string SharedUrlFormat = "https://aka.ms/winforms-warnings/{0}"; | ||
|
||
// Please see docs\project\list-of-diagnostics.md for instructions on the steps required | ||
// to introduce a new obsoletion, apply it to downlevel builds, claim a diagnostic id, | ||
// and ensure the "aka.ms/dotnet-warnings/{0}" URL points to documentation for the obsoletion | ||
// The diagnostic ids reserved for obsoletions are WFDEV### (WFDEV001 - WFDEV999). | ||
|
||
internal const string DomainUpDownAccessibleObjectMessage = $"{nameof(System.Windows.Forms.DomainUpDown.DomainUpDownAccessibleObject)} is no longer used to provide accessible support for {nameof(System.Windows.Forms.DomainUpDown)} controls."; | ||
internal const string DomainUpDownAccessibleObjectDiagnosticId = "WFDEV002"; | ||
|
||
internal const string DomainItemAccessibleObjectMessage = $"{nameof(System.Windows.Forms.DomainUpDown.DomainItemAccessibleObject)} is no longer used to provide accessible support for {nameof(System.Windows.Forms.DomainUpDown)} items."; | ||
internal const string DomainItemAccessibleObjectDiagnosticId = "WFDEV003"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 0 additions & 76 deletions
76
...tem.Windows.Forms/src/System/Windows/Forms/DomainUpDown.DomainItemListAccessibleObject.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.