Browse Source
Merge pull request #9685 from workgroupengineering/features/NetAnalyzers/CA1823
feat: Enable Rule CA1823
pull/9694/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with
7 additions and
39 deletions
-
.editorconfig
-
src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs
-
src/Avalonia.Base/Data/Core/ExpressionNode.cs
-
src/Avalonia.Base/Data/Core/ExpressionObserver.cs
-
src/Avalonia.Base/Media/TextFormatting/FormattedTextSource.cs
-
src/Avalonia.Base/Media/TextFormatting/Unicode/CodepointEnumerator.cs
-
src/Avalonia.Controls.DataGrid/DataGrid.cs
-
src/Avalonia.Controls.DataGrid/DataGridColumnHeader.cs
-
src/Avalonia.Controls.DataGrid/DataGridRowHeader.cs
-
src/Avalonia.Controls/Presenters/TextPresenter.cs
-
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs
-
src/Avalonia.Controls/Window.cs
-
src/Avalonia.Diagnostics/Diagnostics/Controls/Application.cs
-
src/Avalonia.Native/ClipboardImpl.cs
-
src/Avalonia.Native/IAvnMenu.cs
-
src/Avalonia.Native/WindowImplBase.cs
-
src/Avalonia.X11/X11Clipboard.cs
-
src/Browser/Avalonia.Browser/BrowserNativeControlHost.cs
-
src/Linux/Avalonia.LinuxFramebuffer/Input/EvDev/EvDevBackend.cs
-
src/Linux/Avalonia.LinuxFramebuffer/Input/LibInput/LibInputBackend.cs
-
src/Windows/Avalonia.Win32/Interop/Automation/UiaCoreTypesApi.cs
-
src/Windows/Avalonia.Win32/WindowImpl.cs
|
|
|
@ -152,6 +152,8 @@ dotnet_diagnostic.CA1820.severity = warning |
|
|
|
dotnet_diagnostic.CA1821.severity = warning |
|
|
|
# CA1822: Mark members as static |
|
|
|
dotnet_diagnostic.CA1822.severity = suggestion |
|
|
|
# CA1823: Avoid unused private fields |
|
|
|
dotnet_diagnostic.CA1823.severity = warning |
|
|
|
dotnet_code_quality.CA1822.api_surface = private, internal |
|
|
|
# CA1825: Avoid zero-length array allocations |
|
|
|
dotnet_diagnostic.CA1825.severity = warning |
|
|
|
|
|
|
|
@ -96,12 +96,14 @@ namespace Avalonia.Android.Platform.SkiaPlatform |
|
|
|
public IntPtr bits; |
|
|
|
|
|
|
|
// Do not touch.
|
|
|
|
#pragma warning disable CA1823 // Avoid unused private fields
|
|
|
|
uint reserved1; |
|
|
|
uint reserved2; |
|
|
|
uint reserved3; |
|
|
|
uint reserved4; |
|
|
|
uint reserved5; |
|
|
|
uint reserved6; |
|
|
|
#pragma warning restore CA1823 // Avoid unused private fields
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -4,8 +4,6 @@ namespace Avalonia.Data.Core |
|
|
|
{ |
|
|
|
public abstract class ExpressionNode |
|
|
|
{ |
|
|
|
private static readonly object CacheInvalid = new object(); |
|
|
|
|
|
|
|
protected static readonly WeakReference<object?> UnsetReference = |
|
|
|
new WeakReference<object?>(AvaloniaProperty.UnsetValue); |
|
|
|
|
|
|
|
|
|
|
|
@ -49,8 +49,6 @@ namespace Avalonia.Data.Core |
|
|
|
new TaskStreamPlugin(), |
|
|
|
new ObservableStreamPlugin(), |
|
|
|
}; |
|
|
|
|
|
|
|
private static readonly object UninitializedValue = new object(); |
|
|
|
private readonly ExpressionNode _node; |
|
|
|
private object? _root; |
|
|
|
private Func<object?>? _rootGetter; |
|
|
|
|
|
|
|
@ -8,7 +8,6 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
internal readonly struct FormattedTextSource : ITextSource |
|
|
|
{ |
|
|
|
private readonly CharacterBufferRange _text; |
|
|
|
private readonly int length; |
|
|
|
private readonly TextRunProperties _defaultProperties; |
|
|
|
private readonly IReadOnlyList<ValueSpan<TextRunProperties>>? _textModifier; |
|
|
|
|
|
|
|
|
|
|
|
@ -5,7 +5,6 @@ namespace Avalonia.Media.TextFormatting.Unicode |
|
|
|
public ref struct CodepointEnumerator |
|
|
|
{ |
|
|
|
private CharacterBufferRange _text; |
|
|
|
private int _pos; |
|
|
|
|
|
|
|
public CodepointEnumerator(CharacterBufferRange text) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -48,7 +48,6 @@ namespace Avalonia.Controls |
|
|
|
private const string DATAGRID_elementColumnHeadersPresenterName = "PART_ColumnHeadersPresenter"; |
|
|
|
private const string DATAGRID_elementFrozenColumnScrollBarSpacerName = "PART_FrozenColumnScrollBarSpacer"; |
|
|
|
private const string DATAGRID_elementHorizontalScrollbarName = "PART_HorizontalScrollbar"; |
|
|
|
private const string DATAGRID_elementRowHeadersPresenterName = "PART_RowHeadersPresenter"; |
|
|
|
private const string DATAGRID_elementTopLeftCornerHeaderName = "PART_TopLeftCornerHeader"; |
|
|
|
private const string DATAGRID_elementTopRightCornerHeaderName = "PART_TopRightCornerHeader"; |
|
|
|
private const string DATAGRID_elementBottomRightCornerHeaderName = "PART_BottomRightCorner"; |
|
|
|
|
|
|
|
@ -34,7 +34,6 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
|
|
|
|
private const int DATAGRIDCOLUMNHEADER_resizeRegionWidth = 5; |
|
|
|
private const double DATAGRIDCOLUMNHEADER_separatorThickness = 1; |
|
|
|
private const int DATAGRIDCOLUMNHEADER_columnsDragTreshold = 5; |
|
|
|
|
|
|
|
private bool _areHandlersSuspended; |
|
|
|
|
|
|
|
@ -18,8 +18,6 @@ namespace Avalonia.Controls.Primitives |
|
|
|
public class DataGridRowHeader : ContentControl |
|
|
|
{ |
|
|
|
private const string DATAGRIDROWHEADER_elementRootName = "PART_Root"; |
|
|
|
private const double DATAGRIDROWHEADER_separatorThickness = 1; |
|
|
|
|
|
|
|
private Control _rootElement; |
|
|
|
|
|
|
|
public static readonly StyledProperty<IBrush> SeparatorBrushProperty = |
|
|
|
|
|
|
|
@ -106,7 +106,6 @@ namespace Avalonia.Controls.Presenters |
|
|
|
private Rect _caretBounds; |
|
|
|
private Point _navigationPosition; |
|
|
|
private string? _preeditText; |
|
|
|
private CharacterHit _compositionStartHit = new CharacterHit(-1); |
|
|
|
|
|
|
|
static TextPresenter() |
|
|
|
{ |
|
|
|
|
|
|
|
@ -119,8 +119,6 @@ namespace Avalonia.Controls.Primitives |
|
|
|
/// </summary>
|
|
|
|
public static readonly StyledProperty<bool> WrapSelectionProperty = |
|
|
|
AvaloniaProperty.Register<SelectingItemsControl, bool>(nameof(WrapSelection), defaultValue: false); |
|
|
|
|
|
|
|
private static readonly IList Empty = Array.Empty<object>(); |
|
|
|
private string _textSearchTerm = string.Empty; |
|
|
|
private DispatcherTimer? _textSearchTimer; |
|
|
|
private ISelectionModel? _selection; |
|
|
|
|
|
|
|
@ -169,10 +169,6 @@ namespace Avalonia.Controls |
|
|
|
/// </summary>
|
|
|
|
public static readonly RoutedEvent<RoutedEventArgs> WindowOpenedEvent = |
|
|
|
RoutedEvent.Register<Window, RoutedEventArgs>("WindowOpened", RoutingStrategies.Direct); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly NameScope _nameScope = new NameScope(); |
|
|
|
private object? _dialogResult; |
|
|
|
private readonly Size _maxPlatformClientSize; |
|
|
|
private WindowStartupLocation _windowStartupLocation; |
|
|
|
@ -235,7 +231,7 @@ namespace Avalonia.Controls |
|
|
|
impl.GotInputWhenDisabled = OnGotInputWhenDisabled; |
|
|
|
impl.WindowStateChanged = HandleWindowStateChanged; |
|
|
|
_maxPlatformClientSize = PlatformImpl?.MaxAutoSizeHint ?? default(Size); |
|
|
|
impl.ExtendClientAreaToDecorationsChanged = ExtendClientAreaToDecorationsChanged; |
|
|
|
impl.ExtendClientAreaToDecorationsChanged = ExtendClientAreaToDecorationsChanged; |
|
|
|
this.GetObservable(ClientSizeProperty).Skip(1).Subscribe(x => PlatformImpl?.Resize(x, PlatformResizeReason.Application)); |
|
|
|
|
|
|
|
PlatformImpl?.ShowTaskbarIcon(ShowInTaskbar); |
|
|
|
|
|
|
|
@ -10,8 +10,7 @@ namespace Avalonia.Diagnostics.Controls |
|
|
|
|
|
|
|
{ |
|
|
|
private readonly App _application; |
|
|
|
private static readonly Version s_version = typeof(AvaloniaObject).Assembly?.GetName()?.Version |
|
|
|
?? Version.Parse("0.0.00"); |
|
|
|
|
|
|
|
public event EventHandler? Closed; |
|
|
|
|
|
|
|
public Application(App application) |
|
|
|
|
|
|
|
@ -15,8 +15,7 @@ namespace Avalonia.Native |
|
|
|
private IAvnClipboard _native; |
|
|
|
private const string NSPasteboardTypeString = "public.utf8-plain-text"; |
|
|
|
private const string NSFilenamesPboardType = "NSFilenamesPboardType"; |
|
|
|
private const string NSPasteboardTypeFileUrl = "public.file-url"; |
|
|
|
|
|
|
|
|
|
|
|
public ClipboardImpl(IAvnClipboard native) |
|
|
|
{ |
|
|
|
_native = native; |
|
|
|
|
|
|
|
@ -46,7 +46,6 @@ namespace Avalonia.Native.Interop.Impl |
|
|
|
private AvaloniaNativeMenuExporter _exporter; |
|
|
|
private List<__MicroComIAvnMenuItemProxy> _menuItems = new List<__MicroComIAvnMenuItemProxy>(); |
|
|
|
private Dictionary<NativeMenuItemBase, __MicroComIAvnMenuItemProxy> _menuItemLookup = new Dictionary<NativeMenuItemBase, __MicroComIAvnMenuItemProxy>(); |
|
|
|
private CompositeDisposable _propertyDisposables = new CompositeDisposable(); |
|
|
|
|
|
|
|
public void RaiseNeedsUpdate() |
|
|
|
{ |
|
|
|
|
|
|
|
@ -63,7 +63,6 @@ namespace Avalonia.Native |
|
|
|
private double _savedScaling; |
|
|
|
private GlPlatformSurface _glSurface; |
|
|
|
private NativeControlHostImpl _nativeControlHost; |
|
|
|
private IGlContext _glContext; |
|
|
|
|
|
|
|
internal WindowBaseImpl(IAvaloniaNativeFactory factory, AvaloniaNativePlatformOptions opts, |
|
|
|
AvaloniaNativeGlPlatformGraphics glFeature) |
|
|
|
|
|
|
|
@ -18,8 +18,6 @@ namespace Avalonia.X11 |
|
|
|
private TaskCompletionSource<object> _requestedDataTcs; |
|
|
|
private readonly IntPtr[] _textAtoms; |
|
|
|
private readonly IntPtr _avaloniaSaveTargetsAtom; |
|
|
|
private readonly Dictionary<string, IntPtr> _formatAtoms = new Dictionary<string, IntPtr>(); |
|
|
|
private readonly Dictionary<IntPtr, string> _atomFormats = new Dictionary<IntPtr, string>(); |
|
|
|
|
|
|
|
public X11Clipboard(AvaloniaX11Platform platform) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -55,12 +55,6 @@ namespace Avalonia.Browser |
|
|
|
|
|
|
|
private class Attachment : INativeControlHostControlTopLevelAttachment |
|
|
|
{ |
|
|
|
private const string InitializeWithChildHandleSymbol = "InitializeWithChildHandle"; |
|
|
|
private const string AttachToSymbol = "AttachTo"; |
|
|
|
private const string ShowInBoundsSymbol = "ShowInBounds"; |
|
|
|
private const string HideWithSizeSymbol = "HideWithSize"; |
|
|
|
private const string ReleaseChildSymbol = "ReleaseChild"; |
|
|
|
|
|
|
|
private JSObject? _native; |
|
|
|
private BrowserNativeControlHost? _attachedTo; |
|
|
|
|
|
|
|
|
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic; |
|
|
|
using System.Threading; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Input.Raw; |
|
|
|
using Avalonia.Threading; |
|
|
|
using static Avalonia.LinuxFramebuffer.NativeUnsafeMethods; |
|
|
|
|
|
|
|
namespace Avalonia.LinuxFramebuffer.Input.EvDev |
|
|
|
@ -13,7 +12,6 @@ namespace Avalonia.LinuxFramebuffer.Input.EvDev |
|
|
|
private readonly EvDevDeviceDescription[] _deviceDescriptions; |
|
|
|
private readonly List<EvDevDeviceHandler> _handlers = new List<EvDevDeviceHandler>(); |
|
|
|
private int _epoll; |
|
|
|
private object _lock = new object(); |
|
|
|
private Action<RawInputEventArgs> _onInput; |
|
|
|
private IInputRoot _inputRoot; |
|
|
|
private RawEventGroupingThreadingHelper _inputQueue; |
|
|
|
|
|
|
|
@ -11,7 +11,6 @@ namespace Avalonia.LinuxFramebuffer.Input.LibInput |
|
|
|
{ |
|
|
|
private IScreenInfoProvider _screen; |
|
|
|
private IInputRoot _inputRoot; |
|
|
|
private readonly Queue<Action> _inputThreadActions = new Queue<Action>(); |
|
|
|
private TouchDevice _touch = new TouchDevice(); |
|
|
|
private const string LibInput = nameof(Avalonia.LinuxFramebuffer) + "/" + nameof(Avalonia.LinuxFramebuffer.Input) + "/" + nameof(LibInput); |
|
|
|
private readonly RawEventGroupingThreadingHelper _inputQueue; |
|
|
|
|
|
|
|
@ -6,8 +6,6 @@ namespace Avalonia.Win32.Interop.Automation |
|
|
|
{ |
|
|
|
internal static class UiaCoreTypesApi |
|
|
|
{ |
|
|
|
private const string StartListeningExportName = "SynchronizedInputPattern_StartListening"; |
|
|
|
|
|
|
|
internal enum AutomationIdType |
|
|
|
{ |
|
|
|
Property, |
|
|
|
|
|
|
|
@ -1343,8 +1343,6 @@ namespace Avalonia.Win32 |
|
|
|
} |
|
|
|
|
|
|
|
private const int MF_BYCOMMAND = 0x0; |
|
|
|
private const int MF_BYPOSITION = 0x400; |
|
|
|
private const int MF_REMOVE = 0x1000; |
|
|
|
private const int MF_ENABLED = 0x0; |
|
|
|
private const int MF_GRAYED = 0x1; |
|
|
|
private const int MF_DISABLED = 0x2; |
|
|
|
|