You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The MorestachioFormatterService is not thread safe.
To Reproduce
XXX threw exception:
System.TypeInitializationException: The type initializer for 'Morestachio.Formatter.Framework.MorestachioFormatterService' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Morestachio.Formatter.Predefined.Accounting.CurrencyHandler' threw an exception. ---> System.ArgumentException: An item with the same key has already been added. Key: PYG
Stack Trace:
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at Morestachio.Formatter.Predefined.Accounting.CurrencyHandler..cctor()
--- End of inner exception stack trace ---
at Morestachio.Formatter.Predefined.Accounting.CurrencyHandler.get_DefaultHandler()
at Morestachio.Formatter.Framework.MorestachioFormatterService..cctor()
--- End of inner exception stack trace ---
at Morestachio.Formatter.Framework.MorestachioFormatterService..ctor(Boolean useCache)
at Morestachio.ParserOptions..ctor(ITemplateContainer template, Func`2 sourceStream, Encoding encoding)
at Morestachio.ParserOptions..ctor(ITemplateContainer template, Func`1 sourceStream, Encoding encoding)
at Morestachio.ParserOptions..ctor(String template, Func`1 sourceStream, Encoding encoding)
at Morestachio.ParserOptions..ctor(String template, Func`1 sourceStream)
at Morestachio.ParserOptions..ctor(String template)
Describe the bug
The
MorestachioFormatterService
is not thread safe.To Reproduce
Expected behavior
Should use thread safe collections internally: https://docs.microsoft.com/en-us/dotnet/standard/collections/thread-safe/
The text was updated successfully, but these errors were encountered: