Skip to content
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

J nery/build warnings #572

Merged
merged 3 commits into from
May 28, 2024
Merged

J nery/build warnings #572

merged 3 commits into from
May 28, 2024

Conversation

jnery-yy
Copy link

To handle the following warnings

\Toolkit.UI.Controls\UtilityNetworkTraceTool\UtilityNetworkTraceTool.Appearance.cs(67,26,67,49): warning CA1001: Type 'UtilityNetworkTraceTool' owns disposable field(s) '_controller', '_identifyLayersCts' but is not disposable
\Toolkit.UI.Controls\UtilityNetworkTraceTool\UtilityNetworkTraceTool.Appearance.cs(67,26,67,49): warning CA1001: Type 'UtilityNetworkTraceTool' owns disposable field(s) '_controller', '_identifyLayersCts' but is not disposable
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.cs(751,64,751,85): warning CS0067: The event 'UtilityNetworkTraceTool.UtilityNetworkChanged' is never used
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.Appearance.cs(22,22,22,45): warning CA1001: Type 'UtilityNetworkTraceTool' owns disposable field(s) '_controller', '_identifyLayersCts' but is not disposable
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.cs(751,64,751,85): warning CS0067: The event 'UtilityNetworkTraceTool.UtilityNetworkChanged' is never used
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.Appearance.cs(22,22,22,45): warning CA1001: Type 'UtilityNetworkTraceTool' owns disposable field(s) '_controller', '_identifyLayersCts' but is not disposable
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.cs(751,64,751,85): warning CS0067: The event 'UtilityNetworkTraceTool.UtilityNetworkChanged' is never used
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.Appearance.cs(22,22,22,45): warning CA1001: Type 'UtilityNetworkTraceTool' owns disposable field(s) '_controller', '_identifyLayersCts' but is not disposable
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.cs(751,64,751,85): warning CS0067: The event 'UtilityNetworkTraceTool.UtilityNetworkChanged' is never used
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.Appearance.cs(22,22,22,45): warning CA1001: Type 'UtilityNetworkTraceTool' owns disposable field(s) '_controller', '_identifyLayersCts' but is not disposable
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.cs(751,64,751,85): warning CS0067: The event 'UtilityNetworkTraceTool.UtilityNetworkChanged' is never used
\Toolkit.Maui\UtilityNetworkTraceTool\UtilityNetworkTraceTool.Appearance.cs(22,22,22,45): warning CA1001: Type 'UtilityNetworkTraceTool' owns disposable field(s) '_controller', '_identifyLayersCts' but is not disposable

.NET MAUI and WinUI do not like disposable objects being part of a class that is not disposable. UtilityNetworkTraceTool could dispose these objects when unloaded, but followed the same pattern that was done on SearchView

UtilityNetworkChanged was not raised on .NET Maui and while fixing this, found UtilityNetworkTraceCompleted could be raised twice.

@jnery-yy jnery-yy requested review from mstefarov and dotMorten May 18, 2024 01:12
@jnery-yy jnery-yy self-assigned this May 18, 2024
Comment on lines +22 to +24
#pragma warning disable CA1001
public partial class UtilityNetworkTraceTool
#pragma warning restore CA1001
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I'd ask for UNTraceTool to be made disposble instead of suppressing warnings. However, looks like the only cancelable things in the UNTraceToolController are CancellationTokenSources, which aren't as big to leave un-disposed (e.g. see dotnet/runtime#29970 (comment)). So I am okay with this.

@jnery-yy jnery-yy merged commit a6ee2c2 into main May 28, 2024
1 check passed
@jnery-yy jnery-yy deleted the jNery/build_warnings branch May 28, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants