diff --git a/docs/core/compatibility/3.1-5.0.md b/docs/core/compatibility/3.1-5.0.md index 2624ae2372098..55d868cf45e2a 100644 --- a/docs/core/compatibility/3.1-5.0.md +++ b/docs/core/compatibility/3.1-5.0.md @@ -58,11 +58,16 @@ If you're migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to v ## Core .NET libraries - [SSE and SSE2 CompareGreaterThan methods properly handle NaN inputs](#sse-and-sse2-comparegreaterthan-methods-properly-handle-nan-inputs) +- [CounterSet.CreateCounterSetInstance now throws InvalidOperationException if instance already exist](#countersetcreatecountersetinstance-now-throws-invalidoperationexception-if-instance-already-exists) [!INCLUDE [sse-comparegreaterthan-intrinsics](../../../includes/core-changes/corefx/5.0/sse-comparegreaterthan-intrinsics.md)] *** +[!INCLUDE [createcountersetinstance-throws-invalidoperation](../../../includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md)] + +*** + ## Globalization - [StringInfo and TextElementEnumerator are now UAX29-compliant](#stringinfo-and-textelementenumerator-are-now-uax29-compliant) diff --git a/docs/core/compatibility/corefx.md b/docs/core/compatibility/corefx.md index cd75230c408a8..d73c7df97bd53 100644 --- a/docs/core/compatibility/corefx.md +++ b/docs/core/compatibility/corefx.md @@ -12,6 +12,7 @@ The following breaking changes are documented on this page: | Breaking change | Version introduced | | - | :-: | | [SSE and SSE2 CompareGreaterThan methods properly handle NaN inputs](#sse-and-sse2-comparegreaterthan-methods-properly-handle-nan-inputs) | 5.0 | +| [CounterSet.CreateCounterSetInstance now throws InvalidOperationException if instance already exist](#countersetcreatecountersetinstance-now-throws-invalidoperationexception-if-instance-already-exists) | 5.0 | | [APIs that report version now report product and not file version](#apis-that-report-version-now-report-product-and-not-file-version) | 3.0 | | [Custom EncoderFallbackBuffer instances cannot fall back recursively](#custom-encoderfallbackbuffer-instances-cannot-fall-back-recursively) | 3.0 | | [Floating point formatting and parsing behavior changes](#floating-point-formatting-and-parsing-behavior-changed) | 3.0 | @@ -40,6 +41,10 @@ The following breaking changes are documented on this page: *** +[!INCLUDE [createcountersetinstance-throws-invalidoperation](../../../includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md)] + +*** + ## .NET Core 3.0 [!INCLUDE[APIs that report version now report product and not file version](~/includes/core-changes/corefx/3.0/version-information-changes.md)] diff --git a/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md b/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md new file mode 100644 index 0000000000000..f710c95a559a7 --- /dev/null +++ b/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md @@ -0,0 +1,36 @@ +### CounterSet.CreateCounterSetInstance now throws InvalidOperationException if instance already exists + +Starting in .NET 5.0, throws an instead of an if the counter set already exists. + +#### Change description + +In .NET Framework and .NET Core 1.0 to 3.1, you can create an instance of the counter set by calling . However, if the counter set already exists, the method throws an exception. + +In .NET 5.0 and later versions, when you call and the counter set exists, an exception is thrown. + +#### Version introduced + +5.0 Preview 5 + +#### Recommended action + +If you catch exceptions in your app when calling , consider also catching exceptions. + +> [!NOTE] +> Catching exceptions is not recommended. + +#### Category + +Core .NET libraries + +#### Affected APIs + +- + +