Skip to content

Duplicate Key in Enum Cache #1857

@zeus82

Description

@zeus82

Looks like the enum cache is not thread safe. When our application starts up, it makes a bunch of requests and more often that not we get a duplicate key exception which traces back to the enum cache.

Here is the stack trace:

   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Nest.Extensions.ToEnum[T](String str) in c:\code\elasticsearch-net\src\Nest\CommonAbstractions\Extensions\Extensions.cs:line 93
   at Nest.Time..ctor(String timeUnit) in c:\code\elasticsearch-net\src\Nest\CommonOptions\TimeUnit\Time.cs:line 66
   at Nest.Time.op_Implicit(String expression) in c:\code\elasticsearch-net\src\Nest\CommonOptions\TimeUnit\Time.cs:line 26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions