Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Starting in .NET 5, CounterSet.CreateCounterSetInstance(String) throws an InvalidOperationException instead of an ArgumentException 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 CreateCounterSetInstance. However, if the counter set already exists, the method throws an ArgumentException exception.
In .NET 5 and later versions, when you call CreateCounterSetInstance and the counter set exists, an InvalidOperationException exception is thrown.
Version introduced
5.0
Recommended action
If you catch ArgumentException exceptions in your app when calling CreateCounterSetInstance, consider also catching InvalidOperationException exceptions.
Note
Catching ArgumentException exceptions is not recommended.