From 7d4349e30bc2be12fc7cec57939a0d46a0fce4a5 Mon Sep 17 00:00:00 2001 From: ZLoo Date: Fri, 12 Jul 2024 18:32:12 +0300 Subject: [PATCH 1/3] fix CA 1033 --- src/Polly/Context.Dictionary.cs | 2 +- src/Polly/Context.cs | 2 +- src/Polly/Polly.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Polly/Context.Dictionary.cs b/src/Polly/Context.Dictionary.cs index 079f7707e89..2d9ac07413d 100644 --- a/src/Polly/Context.Dictionary.cs +++ b/src/Polly/Context.Dictionary.cs @@ -4,7 +4,7 @@ /// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added. /// Do not re-use an instance of across more than one execution. /// -public partial class Context : IDictionary, IDictionary, IReadOnlyDictionary +public sealed partial class Context : IDictionary, IDictionary, IReadOnlyDictionary { // For an individual execution through a policy or policywrap, it is expected that all execution steps (for example executing the user delegate, invoking policy-activity delegates such as onRetry, onBreak, onTimeout etc) execute sequentially. // Therefore, this class is intentionally not constructed to be safe for concurrent access from multiple threads. diff --git a/src/Polly/Context.cs b/src/Polly/Context.cs index 0eff0ca8f45..a3ee5b87748 100644 --- a/src/Polly/Context.cs +++ b/src/Polly/Context.cs @@ -4,7 +4,7 @@ namespace Polly; /// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added. /// Do not re-use an instance of across more than one call through .Execute(...) or .ExecuteAsync(...). /// -public partial class Context +public sealed partial class Context { internal static Context None() => []; diff --git a/src/Polly/Polly.csproj b/src/Polly/Polly.csproj index 8e4e61f41c4..456451d1089 100644 --- a/src/Polly/Polly.csproj +++ b/src/Polly/Polly.csproj @@ -7,7 +7,7 @@ Library 70 true - $(NoWarn);CA1010;CA1031;CA1032;CA1033;CA1051;CA1062;CA1063;CA1064;CA1710;CA1716;CA1724;CA1805;CA1815;CA1816;CA2211 + $(NoWarn);CA1010;CA1031;CA1032;CA1051;CA1062;CA1063;CA1064;CA1710;CA1716;CA1724;CA1805;CA1815;CA1816;CA2211 $(NoWarn);S2223;S3215;S3246;S3971;S4039;S4049;S4457 $(NoWarn);RS0037; From ea4d8512e1e45f7f691ef93941db6490212bd723 Mon Sep 17 00:00:00 2001 From: ZLoo Date: Fri, 12 Jul 2024 22:20:48 +0300 Subject: [PATCH 2/3] fix by feedback PR --- src/Polly/Context.Dictionary.cs | 4 +++- src/Polly/Context.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Polly/Context.Dictionary.cs b/src/Polly/Context.Dictionary.cs index 2d9ac07413d..6e9d70007bf 100644 --- a/src/Polly/Context.Dictionary.cs +++ b/src/Polly/Context.Dictionary.cs @@ -1,10 +1,12 @@ namespace Polly; +#pragma warning disable CA1033 // Interface methods should be callable by child types + /// /// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added. /// Do not re-use an instance of across more than one execution. /// -public sealed partial class Context : IDictionary, IDictionary, IReadOnlyDictionary +public partial class Context : IDictionary, IDictionary, IReadOnlyDictionary { // For an individual execution through a policy or policywrap, it is expected that all execution steps (for example executing the user delegate, invoking policy-activity delegates such as onRetry, onBreak, onTimeout etc) execute sequentially. // Therefore, this class is intentionally not constructed to be safe for concurrent access from multiple threads. diff --git a/src/Polly/Context.cs b/src/Polly/Context.cs index a3ee5b87748..80434351635 100644 --- a/src/Polly/Context.cs +++ b/src/Polly/Context.cs @@ -1,10 +1,12 @@ namespace Polly; +#pragma warning disable CA1033 // Interface methods should be callable by child types + /// /// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added. /// Do not re-use an instance of across more than one call through .Execute(...) or .ExecuteAsync(...). /// -public sealed partial class Context +public partial class Context { internal static Context None() => []; From d8462135057dbfe8d1553063feb7cbdbec48184a Mon Sep 17 00:00:00 2001 From: ZLoo Date: Fri, 12 Jul 2024 22:59:01 +0300 Subject: [PATCH 3/3] Fix by feedback PR --- src/Polly/Context.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Polly/Context.cs b/src/Polly/Context.cs index 80434351635..0eff0ca8f45 100644 --- a/src/Polly/Context.cs +++ b/src/Polly/Context.cs @@ -1,7 +1,5 @@ namespace Polly; -#pragma warning disable CA1033 // Interface methods should be callable by child types - /// /// Context that carries with a single execution through a Policy. Commonly-used properties are directly on the class. Backed by a dictionary of string key / object value pairs, to which user-defined values may be added. /// Do not re-use an instance of across more than one call through .Execute(...) or .ExecuteAsync(...).