* Make internal API ThrowIfDeserializationInProgress internal
also avoid doing costly argument checks
* Make methods public again
* Update src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.SerializationGuard.cs
Co-authored-by: Levi Broderick <GrabYourPitchforks@users.noreply.github.com>
Co-authored-by: Levi Broderick <GrabYourPitchforks@users.noreply.github.com>
using System.Security;
using System.Threading;
+using System.Diagnostics;
namespace System.Runtime.Serialization
{
public static void ThrowIfDeserializationInProgress(string switchSuffix, ref int cachedValue)
{
const string SwitchPrefix = "Switch.System.Runtime.Serialization.SerializationGuard.";
- if (switchSuffix == null)
- {
- throw new ArgumentNullException(nameof(switchSuffix));
- }
- if (string.IsNullOrWhiteSpace(switchSuffix))
- {
- throw new ArgumentException(SR.Argument_EmptyName, nameof(switchSuffix));
- }
+ Debug.Assert(!string.IsNullOrWhiteSpace(switchSuffix));
if (cachedValue == 0)
{