Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ThrowIfDeserializationInProgress() [2/2]

static void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress ( string switchSuffix,
ref int cachedValue )
inlinestatic

Definition at line 532 of file SerializationInfo.cs.

533 {
534 if (cachedValue == 0)
535 {
536 if (AppContext.TryGetSwitch("Switch.System.Runtime.Serialization.SerializationGuard." + switchSuffix, out var isEnabled) && isEnabled)
537 {
538 cachedValue = 1;
539 }
540 else
541 {
542 cachedValue = -1;
543 }
544 }
545 if (cachedValue != 1)
546 {
547 if (cachedValue != -1)
548 {
549 throw new ArgumentOutOfRangeException("cachedValue");
550 }
552 {
553 throw new SerializationException(SR.Format(SR.Serialization_DangerousDeserialization_Switch, "Switch.System.Runtime.Serialization.SerializationGuard." + switchSuffix));
554 }
555 }
556 }

References System.Runtime.Serialization.SerializationInfo.DeserializationInProgress, System.SR.Format(), System.SR.Serialization_DangerousDeserialization_Switch, and System.AppContext.TryGetSwitch().