From cc62830c88e99fb1f65037069eabac117faff5f1 Mon Sep 17 00:00:00 2001 From: Buyaa Namnan Date: Wed, 20 May 2020 18:44:32 -0700 Subject: [PATCH 1/3] Document breaking change in 5.0 --- docs/core/compatibility/3.1-5.0.md | 5 +++ docs/core/compatibility/corefx.md | 5 +++ ...ntersetinstance-throws-invalidoperation.md | 33 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md diff --git a/docs/core/compatibility/3.1-5.0.md b/docs/core/compatibility/3.1-5.0.md index 2624ae2372098..8d5c0fc9d31e4 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](#countersetcreatecounterset-now-throws-invalidoperationexception-if-instance-already-exist) [!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..05a8e1fcd0c7a 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](#countersetcreatecounterset-now-throws-invalidoperationexception-if-instance-already-exist) | 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..a7ca50d06a556 --- /dev/null +++ b/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md @@ -0,0 +1,33 @@ +### CounterSet.CreateCounterSetInstance now throws InvalidOperationException if instance already exist + +Starting in .NET Core 5.0, (string `instanceName`) throws instead of if user attempt to create already existing instance. + +#### Change description + +In .NET Framework and versions of .NET Core prior to 5.0, you could create an instance of the counter set by calling . However, if counter set already exist it would throw ArgumentException exception. + +In .NET Core 5.0 and later versions, when you call and if the counter set exist then would be thrown. + +#### Version introduced + +5.0 Preview 5 + +#### Recommended action + +Catching ArgumentException is not recommended, but if you are catching in your app, you might want to consider also catching . + +#### Category + +Core .NET libraries + +#### Affected APIs + +- + + From 4b826e6f1785fcf20f0d7f383d30cefd1c4e6f16 Mon Sep 17 00:00:00 2001 From: buyaa-n Date: Thu, 21 May 2020 13:03:07 -0700 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Genevieve Warren --- ...atecountersetinstance-throws-invalidoperation.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md b/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md index a7ca50d06a556..a52a3101d41a1 100644 --- a/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md +++ b/includes/core-changes/corefx/5.0/createcountersetinstance-throws-invalidoperation.md @@ -1,12 +1,12 @@ ### CounterSet.CreateCounterSetInstance now throws InvalidOperationException if instance already exist -Starting in .NET Core 5.0, (string `instanceName`) throws instead of if user attempt to create already existing instance. +Starting in .NET 5.0, throws an instead of an if the counter set already exists. #### Change description -In .NET Framework and versions of .NET Core prior to 5.0, you could create an instance of the counter set by calling . However, if counter set already exist it would throw ArgumentException exception. +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 Core 5.0 and later versions, when you call and if the counter set exist then would be thrown. +In .NET 5.0 and later versions, when you call and the counter set exists, an exception is thrown. #### Version introduced @@ -14,7 +14,10 @@ In .NET Core 5.0 and later versions, when you call in your app, you might want to consider also catching . +If you catch exceptions in your app, consider also catching exceptions. + +> [!NOTE] +> Catching exceptions is not recommended. #### Category @@ -22,7 +25,7 @@ Core .NET libraries #### Affected APIs -- +-