Skip to content

Commit 4e54dfd

Browse files
committed
Make the readers dictionary in the registry concurrent to avoid corrupting the dictionary's state when running concurrent operations
1 parent 5015239 commit 4e54dfd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Microsoft.OpenApi/Reader/OpenApiReaderRegistry.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license.
33

44
using System;
5+
using System.Collections.Concurrent;
56
using System.Collections.Generic;
67
using Microsoft.OpenApi.Interfaces;
78

@@ -12,7 +13,7 @@ namespace Microsoft.OpenApi.Reader
1213
/// </summary>
1314
public static class OpenApiReaderRegistry
1415
{
15-
private static readonly Dictionary<string, IOpenApiReader> _readers = new(StringComparer.OrdinalIgnoreCase);
16+
private static readonly ConcurrentDictionary<string, IOpenApiReader> _readers = new(StringComparer.OrdinalIgnoreCase);
1617

1718
/// <summary>
1819
/// Defines a default OpenAPI reader.

0 commit comments

Comments
 (0)