Addressing warnings in the repo #6810

Closed
opened 2026-02-07 04:08:25 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @richlander on GitHub (Mar 9, 2025).

I asked Copilot to write a tool to categorize build warnings (as of March 8th). I wanted to know if you wanted some help to work towards getting these to zero. Warnings are only really useful if they are driving change. I understand (or at least assume) that many of these (particularly the properties that return arrays) cannot be addressed due to compat. If so, we should quiet the warnings at those sites. I can help with that. I've made similar contributions on this project before.

Project Table

Project Count
Emby.Naming.csproj 18
Emby.Server.Implementations.csproj 28
MediaBrowser.Controller.csproj 144
MediaBrowser.Model.csproj 284

Warning Table

ID Count Description
CA1002 48 Change 'List' in 'BaseItemDto.Chapters' to use 'Collection', 'ReadOnlyCollection' or 'KeyedCollection<K,V>'
CA1008 10 Add a member to ExternalIdMediaType that has a value of zero with a suggested name of 'None'
CA1027 4 Mark enums with FlagsAttribute
CA1033 2 Make 'BaseItem' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'MediaBrowser.Controller.Providers.IHasLookupInfo<MediaBrowser.Controller.Providers.ItemLookupInfo>.GetLookupInfo' and is visible to derived classes
CA1036 2 AudioBookFileInfo should define operator(s) '==, !=, <, <=, >, >=' and Equals since it implements IComparable
CA1051 6 Do not declare visible instance fields
CA1069 2 The enum member 'Superceded' has the same constant value '-4' as member 'Superseded'
CA1711 4 Rename type name MediaStream so that it does not end in 'Stream'
CA1721 40 The property name 'TypeOptions' is confusing given the existence of method 'GetTypeOptions'. Rename or remove one of these members.
CA1815 12 ImageDimensions should override Equals
CA1819 276 Properties should not return arrays
CA1852 2 Type 'StackMetadata' can be sealed because it has no subtypes in its containing assembly and is not externally visible
CA2007 14 Consider calling ConfigureAwait on the awaited task
CA2100 6 Review if the query string passed to 'string SqliteCommand.CommandText' in 'Query', accepts any user input
CA2213 2 'ApplicationHost' contains field '_pluginManager' that is of IDisposable type 'PluginManager', but it is never disposed. Change the Dispose method on 'ApplicationHost' to call Close or Dispose on this field.
CA2227 40 Change 'ImageTags' to be read-only by removing the property setter
CA2263 4 Prefer the generic overload 'System.Enum.Parse(string, bool)' instead of 'System.Enum.Parse(System.Type, string, bool)'

Heavy Hitters Table

Project ID Count Description
MediaBrowser.Model.csproj CA1819 222 Properties should not return arrays
MediaBrowser.Controller.csproj CA1819 52 Properties should not return arrays
Emby.Server.Implementations.csproj CA2007 14 Consider calling ConfigureAwait on the awaited task
Emby.Naming.csproj CA1815 8 ImageDimensions should override Equals
Originally created by @richlander on GitHub (Mar 9, 2025). I asked Copilot to write a tool to categorize build warnings (as of March 8th). I wanted to know if you wanted some help to work towards getting these to zero. Warnings are only really useful if they are driving change. I understand (or at least assume) that many of these (particularly the properties that return arrays) cannot be addressed due to compat. If so, we should quiet the warnings at those sites. I can help with that. I've made similar contributions on this project before. ## Project Table | Project | Count | | --- | --- | | Emby.Naming.csproj | 18 | | Emby.Server.Implementations.csproj | 28 | | MediaBrowser.Controller.csproj | 144 | | MediaBrowser.Model.csproj | 284 | ## Warning Table | ID | Count | Description | | --- | --- | --- | | CA1002 | 48 | [Change 'List<ChapterInfo>' in 'BaseItemDto.Chapters' to use 'Collection<T>', 'ReadOnlyCollection<T>' or 'KeyedCollection<K,V>'](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1002) | | CA1008 | 10 | [Add a member to ExternalIdMediaType that has a value of zero with a suggested name of 'None'](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1008) | | CA1027 | 4 | [Mark enums with FlagsAttribute](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1027) | | CA1033 | 2 | [Make 'BaseItem' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'MediaBrowser.Controller.Providers.IHasLookupInfo<MediaBrowser.Controller.Providers.ItemLookupInfo>.GetLookupInfo' and is visible to derived classes](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033) | | CA1036 | 2 | [AudioBookFileInfo should define operator(s) '==, !=, <, <=, >, >=' and Equals since it implements IComparable](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1036) | | CA1051 | 6 | [Do not declare visible instance fields](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1051) | | CA1069 | 2 | [The enum member 'Superceded' has the same constant value '-4' as member 'Superseded'](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1069) | | CA1711 | 4 | [Rename type name MediaStream so that it does not end in 'Stream'](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1711) | | CA1721 | 40 | [The property name 'TypeOptions' is confusing given the existence of method 'GetTypeOptions'. Rename or remove one of these members.](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1721) | | CA1815 | 12 | [ImageDimensions should override Equals](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815) | | CA1819 | 276 | [Properties should not return arrays](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819) | | CA1852 | 2 | [Type 'StackMetadata' can be sealed because it has no subtypes in its containing assembly and is not externally visible](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852) | | CA2007 | 14 | [Consider calling ConfigureAwait on the awaited task](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007) | | CA2100 | 6 | [Review if the query string passed to 'string SqliteCommand.CommandText' in 'Query', accepts any user input](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2100) | | CA2213 | 2 | ['ApplicationHost' contains field '_pluginManager' that is of IDisposable type 'PluginManager', but it is never disposed. Change the Dispose method on 'ApplicationHost' to call Close or Dispose on this field.](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2213) | | CA2227 | 40 | [Change 'ImageTags' to be read-only by removing the property setter](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2227) | | CA2263 | 4 | [Prefer the generic overload 'System.Enum.Parse<TEnum>(string, bool)' instead of 'System.Enum.Parse(System.Type, string, bool)'](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2263) | ## Heavy Hitters Table | Project | ID | Count | Description | | --- | --- | --- | --- | | MediaBrowser.Model.csproj | CA1819 | 222 | [Properties should not return arrays](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819) | | MediaBrowser.Controller.csproj | CA1819 | 52 | [Properties should not return arrays](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1819) | | Emby.Server.Implementations.csproj | CA2007 | 14 | [Consider calling ConfigureAwait on the awaited task](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2007) | | Emby.Naming.csproj | CA1815 | 8 | [ImageDimensions should override Equals](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1815) |
Author
Owner

@richlander commented on GitHub (Mar 9, 2025):

There are some more warnings coming with .NET 10. I'd like to get a head start on addressing those if that's desired.

https://github.com/NuGet/Home/issues/14168

@richlander commented on GitHub (Mar 9, 2025): There are some more warnings coming with .NET 10. I'd like to get a head start on addressing those if that's desired. https://github.com/NuGet/Home/issues/14168
Author
Owner

@felix920506 commented on GitHub (Mar 9, 2025):

duplicate of #2149

@felix920506 commented on GitHub (Mar 9, 2025): duplicate of #2149
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#6810