Browse Source

Merge pull request #9628 from workgroupengineering/features/NetAnalyzers/CA1815

feat: Enable Rule CA1815
pull/9672/head
Max Katz 3 years ago
committed by GitHub
parent
commit
1add4daecc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .editorconfig
  2. 2
      src/Android/Avalonia.Android/AndroidInputMethod.cs
  3. 11
      src/Avalonia.Base/Animation/Cue.cs
  4. 2
      src/Avalonia.Base/Data/BindingValue.cs
  5. 4
      src/Avalonia.Base/Input/PointerPoint.cs
  6. 2
      src/Avalonia.Base/Input/Raw/RawPointerEventArgs.cs
  7. 2
      src/Avalonia.Base/Input/TextInput/ITextInputMethodClient.cs
  8. 2
      src/Avalonia.Base/Logging/ParametrizedLogger.cs
  9. 2
      src/Avalonia.Base/Matrix.cs
  10. 6
      src/Avalonia.Base/Media/BoxShadow.cs
  11. 8
      src/Avalonia.Base/Media/BoxShadows.cs
  12. 2
      src/Avalonia.Base/Media/DrawingContext.cs
  13. 2
      src/Avalonia.Base/Media/FontMetrics.cs
  14. 2
      src/Avalonia.Base/Media/GlyphMetrics.cs
  15. 2
      src/Avalonia.Base/Media/GlyphRunMetrics.cs
  16. 2
      src/Avalonia.Base/Media/TextCollapsingCreateInfo.cs
  17. 2
      src/Avalonia.Base/Media/TextFormatting/ShapedBuffer.cs
  18. 2
      src/Avalonia.Base/Media/TextFormatting/SplitResult.cs
  19. 2
      src/Avalonia.Base/Media/TextFormatting/TextLineMetrics.cs
  20. 2
      src/Avalonia.Base/Media/TextFormatting/TextMetrics.cs
  21. 2
      src/Avalonia.Base/Media/TextFormatting/TextRange.cs
  22. 2
      src/Avalonia.Base/Media/TextFormatting/TextRunBounds.cs
  23. 2
      src/Avalonia.Base/Media/TextFormatting/TextShaperOptions.cs
  24. 2
      src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs
  25. 2
      src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreak.cs
  26. 2
      src/Avalonia.Base/Media/TextHitTestResult.cs
  27. 12
      src/Avalonia.Base/Media/Transformation/TransformOperation.cs
  28. 2
      src/Avalonia.Base/Media/Transformation/TransformOperations.cs
  29. 4
      src/Avalonia.Base/Media/UnicodeRange.cs
  30. 2
      src/Avalonia.Base/Platform/IRuntimePlatform.cs
  31. 2
      src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs
  32. 2
      src/Avalonia.Base/Styling/SelectorMatch.cs
  33. 2
      src/Avalonia.Base/Utilities/SmallDictionary.cs
  34. 2
      src/Avalonia.Base/Utilities/StringTokenizer.cs
  35. 2
      src/Avalonia.Base/Utilities/SynchronousCompletionAsyncResult.cs
  36. 2
      src/Avalonia.Base/Utilities/ValueSpan.cs
  37. 2
      src/Avalonia.Controls/AcrylicPlatformCompensationLevels.cs
  38. 2
      src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs
  39. 2
      src/Avalonia.Controls/Selection/ISelectionModel.cs
  40. 2
      src/Avalonia.Controls/Selection/SelectionModel.cs
  41. 2
      src/Avalonia.Controls/TextBlock.cs
  42. 2
      src/Avalonia.FreeDesktop/IX11InputMethod.cs
  43. 2
      src/Avalonia.OpenGL/GlVersion.cs
  44. 4
      src/Avalonia.X11/X11Structs.cs
  45. 2
      src/Windows/Avalonia.Direct2D1/OptionalDispose.cs
  46. 2
      src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs

2
.editorconfig

@ -144,6 +144,8 @@ dotnet_diagnostic.CS1591.severity = suggestion
dotnet_diagnostic.CA1304.severity = warning dotnet_diagnostic.CA1304.severity = warning
# CA1802: Use literals where appropriate # CA1802: Use literals where appropriate
dotnet_diagnostic.CA1802.severity = warning dotnet_diagnostic.CA1802.severity = warning
# CA1815: Override equals and operator equals on value types
dotnet_diagnostic.CA1815.severity = warning
# CA1820: Test for empty strings using string length # CA1820: Test for empty strings using string length
dotnet_diagnostic.CA1820.severity = warning dotnet_diagnostic.CA1820.severity = warning
# CA1821: Remove empty finalizers # CA1821: Remove empty finalizers

2
src/Android/Avalonia.Android/AndroidInputMethod.cs

@ -167,7 +167,7 @@ namespace Avalonia.Android
} }
} }
public readonly struct ComposingRegion public readonly record struct ComposingRegion
{ {
private readonly int _start = -1; private readonly int _start = -1;
private readonly int _end = -1; private readonly int _end = -1;

11
src/Avalonia.Base/Animation/Cue.cs

@ -8,7 +8,7 @@ namespace Avalonia.Animation
/// Determines the time index for a <see cref="KeyFrame"/>. /// Determines the time index for a <see cref="KeyFrame"/>.
/// </summary> /// </summary>
[TypeConverter(typeof(CueTypeConverter))] [TypeConverter(typeof(CueTypeConverter))]
public readonly struct Cue : IEquatable<Cue>, IEquatable<double> public readonly record struct Cue : IEquatable<Cue>, IEquatable<double>
{ {
/// <summary> /// <summary>
/// The normalized percent value, ranging from 0.0 to 1.0 /// The normalized percent value, ranging from 0.0 to 1.0
@ -49,15 +49,6 @@ namespace Avalonia.Animation
} }
} }
/// <summary>
/// Checks for equality between two <see cref="Cue"/>s.
/// </summary>
/// <param name="other">The second cue.</param>
public bool Equals(Cue other)
{
return CueValue == other.CueValue;
}
/// <summary> /// <summary>
/// Checks for equality between a <see cref="Cue"/> /// Checks for equality between a <see cref="Cue"/>
/// and a <see cref="double"/> value. /// and a <see cref="double"/> value.

2
src/Avalonia.Base/Data/BindingValue.cs

@ -80,7 +80,7 @@ namespace Avalonia.Data
/// - For an unset value, use <see cref="Unset"/> or simply `default` /// - For an unset value, use <see cref="Unset"/> or simply `default`
/// - For other types, call one of the static factory methods /// - For other types, call one of the static factory methods
/// </remarks> /// </remarks>
public readonly struct BindingValue<T> public readonly record struct BindingValue<T>
{ {
private readonly T _value; private readonly T _value;

4
src/Avalonia.Base/Input/PointerPoint.cs

@ -5,7 +5,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Provides basic properties for the input pointer associated with a single mouse, pen/stylus, or touch contact. /// Provides basic properties for the input pointer associated with a single mouse, pen/stylus, or touch contact.
/// </summary> /// </summary>
public struct PointerPoint public record struct PointerPoint
{ {
public PointerPoint(IPointer pointer, Point position, PointerPointProperties properties) public PointerPoint(IPointer pointer, Point position, PointerPointProperties properties)
{ {
@ -33,7 +33,7 @@ namespace Avalonia.Input
/// <summary> /// <summary>
/// Provides extended properties for a PointerPoint object. /// Provides extended properties for a PointerPoint object.
/// </summary> /// </summary>
public struct PointerPointProperties public record struct PointerPointProperties
{ {
/// <summary> /// <summary>
/// Gets a value that indicates whether the pointer input was triggered by the primary action mode of an input device. /// Gets a value that indicates whether the pointer input was triggered by the primary action mode of an input device.

2
src/Avalonia.Base/Input/Raw/RawPointerEventArgs.cs

@ -130,7 +130,7 @@ namespace Avalonia.Input.Raw
internal IInputElement? InputHitTestResult { get; set; } internal IInputElement? InputHitTestResult { get; set; }
} }
public struct RawPointerPoint public record struct RawPointerPoint
{ {
/// <summary> /// <summary>
/// Pointer position, in client DIPs. /// Pointer position, in client DIPs.

2
src/Avalonia.Base/Input/TextInput/ITextInputMethodClient.cs

@ -46,7 +46,7 @@ namespace Avalonia.Input.TextInput
void SelectInSurroundingText(int start, int end); void SelectInSurroundingText(int start, int end);
} }
public struct TextInputMethodSurroundingText public record struct TextInputMethodSurroundingText
{ {
public string Text { get; set; } public string Text { get; set; }
public int CursorOffset { get; set; } public int CursorOffset { get; set; }

2
src/Avalonia.Base/Logging/ParametrizedLogger.cs

@ -5,7 +5,7 @@ namespace Avalonia.Logging
/// <summary> /// <summary>
/// Logger sink parametrized for given logging level. /// Logger sink parametrized for given logging level.
/// </summary> /// </summary>
public readonly struct ParametrizedLogger public readonly record struct ParametrizedLogger
{ {
private readonly ILogSink _sink; private readonly ILogSink _sink;
private readonly LogEventLevel _level; private readonly LogEventLevel _level;

2
src/Avalonia.Base/Matrix.cs

@ -571,7 +571,7 @@ namespace Avalonia
return true; return true;
} }
public struct Decomposed public record struct Decomposed
{ {
public Vector Translate; public Vector Translate;
public Vector Scale; public Vector Scale;

6
src/Avalonia.Base/Media/BoxShadow.cs

@ -171,5 +171,11 @@ namespace Avalonia.Media
public Rect TransformBounds(in Rect rect) public Rect TransformBounds(in Rect rect)
=> IsInset ? rect : rect.Translate(new Vector(OffsetX, OffsetY)).Inflate(Spread + Blur); => IsInset ? rect : rect.Translate(new Vector(OffsetX, OffsetY)).Inflate(Spread + Blur);
public static bool operator ==(BoxShadow left, BoxShadow right) =>
left.Equals(right);
public static bool operator !=(BoxShadow left, BoxShadow right) =>
!(left == right);
} }
} }

8
src/Avalonia.Base/Media/BoxShadows.cs

@ -62,7 +62,9 @@ namespace Avalonia.Media
} }
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable CA1815 // Override equals and operator equals on value types
public struct BoxShadowsEnumerator public struct BoxShadowsEnumerator
#pragma warning restore CA1815 // Override equals and operator equals on value types
{ {
private int _index; private int _index;
private BoxShadows _shadows; private BoxShadows _shadows;
@ -149,5 +151,11 @@ namespace Avalonia.Media
return hashCode; return hashCode;
} }
} }
public static bool operator ==(BoxShadows left, BoxShadows right) =>
left.Equals(right);
public static bool operator !=(BoxShadows left, BoxShadows right) =>
!(left == right);
} }
} }

2
src/Avalonia.Base/Media/DrawingContext.cs

@ -261,7 +261,7 @@ namespace Avalonia.Media
DrawRectangle(brush, null, rect, cornerRadius, cornerRadius); DrawRectangle(brush, null, rect, cornerRadius, cornerRadius);
} }
public readonly struct PushedState : IDisposable public readonly record struct PushedState : IDisposable
{ {
private readonly int _level; private readonly int _level;
private readonly DrawingContext _context; private readonly DrawingContext _context;

2
src/Avalonia.Base/Media/FontMetrics.cs

@ -3,7 +3,7 @@
/// <summary> /// <summary>
/// The font metrics is holding information about a font's ascent, descent, etc. in design em units. /// The font metrics is holding information about a font's ascent, descent, etc. in design em units.
/// </summary> /// </summary>
public readonly struct FontMetrics public readonly record struct FontMetrics
{ {
/// <summary> /// <summary>
/// Gets the font design units per em. /// Gets the font design units per em.

2
src/Avalonia.Base/Media/GlyphMetrics.cs

@ -1,6 +1,6 @@
namespace Avalonia.Media; namespace Avalonia.Media;
public readonly struct GlyphMetrics public readonly record struct GlyphMetrics
{ {
/// <summary> /// <summary>
/// Distance from the x-origin to the left extremum of the glyph. /// Distance from the x-origin to the left extremum of the glyph.

2
src/Avalonia.Base/Media/GlyphRunMetrics.cs

@ -1,6 +1,6 @@
namespace Avalonia.Media namespace Avalonia.Media
{ {
public readonly struct GlyphRunMetrics public readonly record struct GlyphRunMetrics
{ {
public GlyphRunMetrics(double width, double widthIncludingTrailingWhitespace, double height, public GlyphRunMetrics(double width, double widthIncludingTrailingWhitespace, double height,
int trailingWhitespaceLength, int newLineLength, int firstCluster, int lastCluster) int trailingWhitespaceLength, int newLineLength, int firstCluster, int lastCluster)

2
src/Avalonia.Base/Media/TextCollapsingCreateInfo.cs

@ -2,7 +2,7 @@
namespace Avalonia.Media namespace Avalonia.Media
{ {
public readonly struct TextCollapsingCreateInfo public readonly record struct TextCollapsingCreateInfo
{ {
public readonly double Width; public readonly double Width;
public readonly TextRunProperties TextRunProperties; public readonly TextRunProperties TextRunProperties;

2
src/Avalonia.Base/Media/TextFormatting/ShapedBuffer.cs

@ -262,7 +262,7 @@ namespace Avalonia.Media.TextFormatting
} }
} }
public readonly struct GlyphInfo public readonly record struct GlyphInfo
{ {
public GlyphInfo(ushort glyphIndex, int glyphCluster, double glyphAdvance = 0, Vector glyphOffset = default) public GlyphInfo(ushort glyphIndex, int glyphCluster, double glyphAdvance = 0, Vector glyphOffset = default)
{ {

2
src/Avalonia.Base/Media/TextFormatting/SplitResult.cs

@ -1,6 +1,8 @@
namespace Avalonia.Media.TextFormatting namespace Avalonia.Media.TextFormatting
{ {
#pragma warning disable CA1815 // Override equals and operator equals on value types
public readonly struct SplitResult<T> public readonly struct SplitResult<T>
#pragma warning restore CA1815 // Override equals and operator equals on value types
{ {
public SplitResult(T first, T? second) public SplitResult(T first, T? second)
{ {

2
src/Avalonia.Base/Media/TextFormatting/TextLineMetrics.cs

@ -4,7 +4,7 @@
/// Represents a metric for a <see cref="TextLine"/> objects, /// Represents a metric for a <see cref="TextLine"/> objects,
/// that holds information about ascent, descent, line gap, size and origin of the text line. /// that holds information about ascent, descent, line gap, size and origin of the text line.
/// </summary> /// </summary>
public readonly struct TextLineMetrics public readonly record struct TextLineMetrics
{ {
public TextLineMetrics(bool hasOverflowed, double height, int newlineLength, double start, double textBaseline, public TextLineMetrics(bool hasOverflowed, double height, int newlineLength, double start, double textBaseline,
int trailingWhitespaceLength, double width, int trailingWhitespaceLength, double width,

2
src/Avalonia.Base/Media/TextFormatting/TextMetrics.cs

@ -3,7 +3,7 @@
/// <summary> /// <summary>
/// A metric that holds information about text specific measurements. /// A metric that holds information about text specific measurements.
/// </summary> /// </summary>
public readonly struct TextMetrics public readonly record struct TextMetrics
{ {
public TextMetrics(IGlyphTypeface glyphTypeface, double fontRenderingEmSize) public TextMetrics(IGlyphTypeface glyphTypeface, double fontRenderingEmSize)
{ {

2
src/Avalonia.Base/Media/TextFormatting/TextRange.cs

@ -5,7 +5,7 @@ namespace Avalonia.Media.TextFormatting
/// <summary> /// <summary>
/// References a portion of a text buffer. /// References a portion of a text buffer.
/// </summary> /// </summary>
public readonly struct TextRange public readonly record struct TextRange
{ {
public TextRange(int start, int length) public TextRange(int start, int length)
{ {

2
src/Avalonia.Base/Media/TextFormatting/TextRunBounds.cs

@ -3,7 +3,7 @@
/// <summary> /// <summary>
/// The bounding rectangle of text run /// The bounding rectangle of text run
/// </summary> /// </summary>
public readonly struct TextRunBounds public readonly record struct TextRunBounds
{ {
/// <summary> /// <summary>
/// Constructing TextRunBounds /// Constructing TextRunBounds

2
src/Avalonia.Base/Media/TextFormatting/TextShaperOptions.cs

@ -5,7 +5,7 @@ namespace Avalonia.Media.TextFormatting
/// <summary> /// <summary>
/// Options to customize text shaping. /// Options to customize text shaping.
/// </summary> /// </summary>
public readonly struct TextShaperOptions public readonly record struct TextShaperOptions
{ {
public TextShaperOptions( public TextShaperOptions(
IGlyphTypeface typeface, IGlyphTypeface typeface,

2
src/Avalonia.Base/Media/TextFormatting/Unicode/Codepoint.cs

@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
namespace Avalonia.Media.TextFormatting.Unicode namespace Avalonia.Media.TextFormatting.Unicode
{ {
public readonly struct Codepoint public readonly record struct Codepoint
{ {
private readonly uint _value; private readonly uint _value;

2
src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreak.cs

@ -24,7 +24,7 @@ namespace Avalonia.Media.TextFormatting.Unicode
/// Information about a potential line break position /// Information about a potential line break position
/// </summary> /// </summary>
[DebuggerDisplay("{PositionMeasure}/{PositionWrap} @ {Required}")] [DebuggerDisplay("{PositionMeasure}/{PositionWrap} @ {Required}")]
public readonly struct LineBreak public readonly record struct LineBreak
{ {
/// <summary> /// <summary>
/// Constructor /// Constructor

2
src/Avalonia.Base/Media/TextHitTestResult.cs

@ -5,7 +5,7 @@ namespace Avalonia.Media
/// <summary> /// <summary>
/// Holds a hit test result from a <see cref="TextLayout"/>. /// Holds a hit test result from a <see cref="TextLayout"/>.
/// </summary> /// </summary>
public readonly struct TextHitTestResult public readonly record struct TextHitTestResult
{ {
public TextHitTestResult(CharacterHit characterHit, int textPosition, bool isInside, bool isTrailing) public TextHitTestResult(CharacterHit characterHit, int textPosition, bool isInside, bool isTrailing)
{ {

12
src/Avalonia.Base/Media/Transformation/TransformOperation.cs

@ -5,7 +5,7 @@ namespace Avalonia.Media.Transformation
/// <summary> /// <summary>
/// Represents a single primitive transform (like translation, rotation, scale, etc.). /// Represents a single primitive transform (like translation, rotation, scale, etc.).
/// </summary> /// </summary>
public struct TransformOperation public record struct TransformOperation
{ {
public OperationType Type; public OperationType Type;
public Matrix Matrix; public Matrix Matrix;
@ -196,7 +196,7 @@ namespace Avalonia.Media.Transformation
} }
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
public struct DataLayout public record struct DataLayout
{ {
[FieldOffset(0)] public SkewLayout Skew; [FieldOffset(0)] public SkewLayout Skew;
@ -206,25 +206,25 @@ namespace Avalonia.Media.Transformation
[FieldOffset(0)] public RotateLayout Rotate; [FieldOffset(0)] public RotateLayout Rotate;
public struct SkewLayout public record struct SkewLayout
{ {
public double X; public double X;
public double Y; public double Y;
} }
public struct ScaleLayout public record struct ScaleLayout
{ {
public double X; public double X;
public double Y; public double Y;
} }
public struct TranslateLayout public record struct TranslateLayout
{ {
public double X; public double X;
public double Y; public double Y;
} }
public struct RotateLayout public record struct RotateLayout
{ {
public double Angle; public double Angle;
} }

2
src/Avalonia.Base/Media/Transformation/TransformOperations.cs

@ -165,7 +165,7 @@ namespace Avalonia.Media.Transformation
return Math.Max(from._operations.Count, to._operations.Count); return Math.Max(from._operations.Count, to._operations.Count);
} }
public readonly struct Builder public readonly record struct Builder
{ {
private readonly List<TransformOperation> _operations; private readonly List<TransformOperation> _operations;

4
src/Avalonia.Base/Media/UnicodeRange.cs

@ -7,7 +7,7 @@ namespace Avalonia.Media
/// <summary> /// <summary>
/// The <see cref="UnicodeRange"/> descripes a set of Unicode characters. /// The <see cref="UnicodeRange"/> descripes a set of Unicode characters.
/// </summary> /// </summary>
public readonly struct UnicodeRange public readonly record struct UnicodeRange
{ {
public readonly static UnicodeRange Default = Parse("0-10FFFD"); public readonly static UnicodeRange Default = Parse("0-10FFFD");
@ -102,7 +102,7 @@ namespace Avalonia.Media
} }
} }
public readonly struct UnicodeRangeSegment public readonly record struct UnicodeRangeSegment
{ {
private static Regex s_regex = new Regex(@"^(?:[uU]\+)?(?:([0-9a-fA-F](?:[0-9a-fA-F?]{1,5})?))$"); private static Regex s_regex = new Regex(@"^(?:[uU]\+)?(?:([0-9a-fA-F](?:[0-9a-fA-F?]{1,5})?))$");

2
src/Avalonia.Base/Platform/IRuntimePlatform.cs

@ -21,7 +21,7 @@ namespace Avalonia.Platform
} }
[Unstable] [Unstable]
public struct RuntimePlatformInfo public record struct RuntimePlatformInfo
{ {
public OperatingSystemType OperatingSystem { get; set; } public OperatingSystemType OperatingSystem { get; set; }

2
src/Avalonia.Base/Rendering/Composition/Transport/BatchStream.cs

@ -21,7 +21,7 @@ internal class BatchStreamData
public Queue<BatchStreamSegment<IntPtr>> Structs { get; } = new(); public Queue<BatchStreamSegment<IntPtr>> Structs { get; } = new();
} }
public struct BatchStreamSegment<TData> public record struct BatchStreamSegment<TData>
{ {
public TData Data { get; set; } public TData Data { get; set; }
public int ElementCount { get; set; } public int ElementCount { get; set; }

2
src/Avalonia.Base/Styling/SelectorMatch.cs

@ -43,7 +43,7 @@ namespace Avalonia.Styling
/// A selector match describes whether and how a <see cref="Selector"/> matches a control, and /// A selector match describes whether and how a <see cref="Selector"/> matches a control, and
/// in addition whether the selector can ever match a control of the same type. /// in addition whether the selector can ever match a control of the same type.
/// </remarks> /// </remarks>
public readonly struct SelectorMatch public readonly record struct SelectorMatch
{ {
/// <summary> /// <summary>
/// A selector match with the result of <see cref="SelectorMatchResult.NeverThisType"/>. /// A selector match with the result of <see cref="SelectorMatchResult.NeverThisType"/>.

2
src/Avalonia.Base/Utilities/SmallDictionary.cs

@ -5,7 +5,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Avalonia.Utilities; namespace Avalonia.Utilities;
public struct InlineDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>> where TKey : class where TValue : class public record struct InlineDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>> where TKey : class where TValue : class
{ {
object? _data; object? _data;
TValue? _value; TValue? _value;

2
src/Avalonia.Base/Utilities/StringTokenizer.cs

@ -8,7 +8,7 @@ namespace Avalonia.Utilities
#if !BUILDTASK #if !BUILDTASK
public public
#endif #endif
struct StringTokenizer : IDisposable record struct StringTokenizer : IDisposable
{ {
private const char DefaultSeparatorChar = ','; private const char DefaultSeparatorChar = ',';

2
src/Avalonia.Base/Utilities/SynchronousCompletionAsyncResult.cs

@ -8,7 +8,7 @@ namespace Avalonia.Utilities
/// A task-like operation that is guaranteed to finish continuations synchronously, /// A task-like operation that is guaranteed to finish continuations synchronously,
/// can be used for parametrized one-shot events /// can be used for parametrized one-shot events
/// </summary> /// </summary>
public struct SynchronousCompletionAsyncResult<T> : INotifyCompletion public record struct SynchronousCompletionAsyncResult<T> : INotifyCompletion
{ {
private readonly SynchronousCompletionAsyncResultSource<T>? _source; private readonly SynchronousCompletionAsyncResultSource<T>? _source;
private readonly T? _result; private readonly T? _result;

2
src/Avalonia.Base/Utilities/ValueSpan.cs

@ -3,7 +3,7 @@
/// <summary> /// <summary>
/// Pairing of value and positions sharing that value. /// Pairing of value and positions sharing that value.
/// </summary> /// </summary>
public readonly struct ValueSpan<T> public readonly record struct ValueSpan<T>
{ {
public ValueSpan(int start, int length, T value) public ValueSpan(int start, int length, T value)
{ {

2
src/Avalonia.Controls/AcrylicPlatformCompensationLevels.cs

@ -5,7 +5,7 @@
/// It controls the base opacity level of the 'tracing paper' layer that compensates /// It controls the base opacity level of the 'tracing paper' layer that compensates
/// for low blur radius. /// for low blur radius.
/// </summary> /// </summary>
public struct AcrylicPlatformCompensationLevels public record struct AcrylicPlatformCompensationLevels
{ {
public AcrylicPlatformCompensationLevels(double transparent, double blurred, double acrylic) public AcrylicPlatformCompensationLevels(double transparent, double blurred, double acrylic)
{ {

2
src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs

@ -64,7 +64,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning
/// surface. /// surface.
/// </remarks> /// </remarks>
[Unstable] [Unstable]
public struct PopupPositionerParameters public record struct PopupPositionerParameters
{ {
private PopupGravity _gravity; private PopupGravity _gravity;
private PopupAnchor _anchor; private PopupAnchor _anchor;

2
src/Avalonia.Controls/Selection/ISelectionModel.cs

@ -39,7 +39,7 @@ namespace Avalonia.Controls.Selection
return new BatchUpdateOperation(model); return new BatchUpdateOperation(model);
} }
public struct BatchUpdateOperation : IDisposable public record struct BatchUpdateOperation : IDisposable
{ {
private readonly ISelectionModel _owner; private readonly ISelectionModel _owner;
private bool _isDisposed; private bool _isDisposed;

2
src/Avalonia.Controls/Selection/SelectionModel.cs

@ -738,7 +738,7 @@ namespace Avalonia.Controls.Selection
} }
} }
public struct BatchUpdateOperation : IDisposable public record struct BatchUpdateOperation : IDisposable
{ {
private readonly SelectionModel<T> _owner; private readonly SelectionModel<T> _owner;
private bool _isDisposed; private bool _isDisposed;

2
src/Avalonia.Controls/TextBlock.cs

@ -827,7 +827,7 @@ namespace Avalonia.Controls
InvalidateTextLayout(); InvalidateTextLayout();
} }
protected readonly struct SimpleTextSource : ITextSource protected readonly record struct SimpleTextSource : ITextSource
{ {
private readonly CharacterBufferRange _text; private readonly CharacterBufferRange _text;
private readonly TextRunProperties _defaultProperties; private readonly TextRunProperties _defaultProperties;

2
src/Avalonia.FreeDesktop/IX11InputMethod.cs

@ -11,7 +11,9 @@ namespace Avalonia.FreeDesktop
(ITextInputMethodImpl method, IX11InputMethodControl control) CreateClient(IntPtr xid); (ITextInputMethodImpl method, IX11InputMethodControl control) CreateClient(IntPtr xid);
} }
#pragma warning disable CA1815 // Override equals and operator equals on value types
public struct X11InputMethodForwardedKey public struct X11InputMethodForwardedKey
#pragma warning restore CA1815 // Override equals and operator equals on value types
{ {
public int KeyVal { get; set; } public int KeyVal { get; set; }
public KeyModifiers Modifiers { get; set; } public KeyModifiers Modifiers { get; set; }

2
src/Avalonia.OpenGL/GlVersion.cs

@ -6,7 +6,7 @@ namespace Avalonia.OpenGL
OpenGLES OpenGLES
} }
public struct GlVersion public record struct GlVersion
{ {
public GlProfileType Type { get; } public GlProfileType Type { get; }
public int Major { get; } public int Major { get; }

4
src/Avalonia.X11/X11Structs.cs

@ -1768,7 +1768,9 @@ namespace Avalonia.X11 {
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
#pragma warning disable CA1815 // Override equals and operator equals on value types
public unsafe struct XImage public unsafe struct XImage
#pragma warning restore CA1815 // Override equals and operator equals on value types
{ {
public int width, height; /* size of image */ public int width, height; /* size of image */
public int xoffset; /* number of pixels offset in X direction */ public int xoffset; /* number of pixels offset in X direction */
@ -1799,7 +1801,7 @@ namespace Avalonia.X11 {
internal IntPtr green_mask; internal IntPtr green_mask;
internal IntPtr blue_mask; internal IntPtr blue_mask;
internal int colormap_size; internal int colormap_size;
internal int bits_per_rgb; internal int bits_per_rgb;
} }
internal enum XIMFeedback internal enum XIMFeedback

2
src/Windows/Avalonia.Direct2D1/OptionalDispose.cs

@ -2,7 +2,7 @@
namespace Avalonia.Direct2D1 namespace Avalonia.Direct2D1
{ {
public readonly struct OptionalDispose<T> : IDisposable where T : IDisposable public readonly record struct OptionalDispose<T> : IDisposable where T : IDisposable
{ {
private readonly bool _dispose; private readonly bool _dispose;

2
src/Windows/Avalonia.Win32/WinRT/WinRTColor.cs

@ -3,7 +3,7 @@
namespace Avalonia.Win32.WinRT namespace Avalonia.Win32.WinRT
{ {
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct WinRTColor public record struct WinRTColor
{ {
public byte A; public byte A;
public byte R; public byte R;

Loading…
Cancel
Save