diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs index e4c99cf41ff..508a072c545 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs @@ -740,10 +740,10 @@ public List GetSanitizers() /// public List GetRegisteredSanitizers(ModifiableRecordSession session) { - var sanitizers = new List(); - lock (session.SanitizerLock) { + var sanitizers = new List(); + foreach (var id in session.AppliedSanitizers) { if (Sanitizers.TryGetValue(id, out RegisteredSanitizer sanitizer)) @@ -755,9 +755,9 @@ public List GetRegisteredSanitizers(ModifiableRecordSession DebugLogger.LogError($"Failed to get a sanitizer with id {id}"); } } - } - return sanitizers; + return sanitizers; + } } /// @@ -766,9 +766,10 @@ public List GetRegisteredSanitizers(ModifiableRecordSession /// public List GetRegisteredSanitizers() { - var sanitizers = new List(); lock (SessionSanitizerLock) { + var sanitizers = new List(); + foreach (var id in SessionSanitizers) { if (Sanitizers.TryGetValue(id, out RegisteredSanitizer sanitizer)) @@ -776,9 +777,9 @@ public List GetRegisteredSanitizers() sanitizers.Add(sanitizer); } } - } - return sanitizers; + return sanitizers; + } } private bool _register(RecordedTestSanitizer sanitizer, string id)