microsoft / Recognizers-Text

Microsoft.Recognizers.Text provides recognition and resolution of numbers, units, date/time, etc. in multiple languages (ZH, EN, FR, ES, PT, DE, IT, TR, HI, NL. Partial support for JA, KO, AR, SV). Packages available at: https://www.nuget.org/profiles/Recognizers.Text, https://www.npmjs.com/~recognizers.text
MIT License
1.67k stars 429 forks source link

[Infra] InvalidOperationException when running all unit tests concurrently #3077

Open zoinkydoink opened 1 year ago

zoinkydoink commented 1 year ago

I have verified I am not using any shared resources when running my unit tests, but when i run all of them, i get following errors on Recognizer code. When run individually, it seems to work


System.InvalidOperationException
Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
   at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
   at Microsoft.Recognizers.Text.Matcher.Node`1.get_Item(T c)
   at Microsoft.Recognizers.Text.Matcher.TrieTree`1.Insert(IEnumerable`1 value, String id)
   at Microsoft.Recognizers.Text.Matcher.AbstractMatcher`1.BatchInsert(IEnumerable`1[] values, String[] ids)
   at Microsoft.Recognizers.Text.Matcher.TrieTree`1.Init(IEnumerable`1[] values, String[] ids)
   at Microsoft.Recognizers.Text.Matcher.StringMatcher.Init(IEnumerable`1[] tokenizedValues, String[] ids)
   at Microsoft.Recognizers.Text.Matcher.StringMatcher.Init(IEnumerable`1 values, String[] ids)
   at Microsoft.Recognizers.Text.Matcher.StringMatcher.Init(IEnumerable`1 values)
   at Microsoft.Recognizers.Text.DateTime.English.EnglishTimeZoneExtractorConfiguration..ctor(IDateTimeOptionsConfiguration config)
   at Microsoft.Recognizers.Text.DateTime.English.EnglishTimeExtractorConfiguration..ctor(IDateTimeOptionsConfiguration config)
   at Microsoft.Recognizers.Text.DateTime.English.EnglishCommonDateTimeParserConfiguration..ctor(IDateTimeOptionsConfiguration config)
   at Microsoft.Recognizers.Text.DateTime.English.EnglishMergedParserConfiguration..ctor(IDateTimeOptionsConfiguration config)
   at Microsoft.Recognizers.Text.DateTime.DateTimeRecognizer.<>c.<InitializeConfiguration>b__6_0(DateTimeOptions options)
   at Microsoft.Recognizers.Text.ModelFactory`1.TryGetModel(Type modelType, String reqCulture, TModelOptions options, IModel& model)
   at Microsoft.Recognizers.Text.ModelFactory`1.TryGetModel[T](String culture, TModelOptions options, T& model)
   at Microsoft.Recognizers.Text.ModelFactory`1.GetModel[T](String culture, Boolean fallbackToDefaultCulture, TModelOptions options)
   at Microsoft.Recognizers.Text.Recognizer`1.GetModel[T](String culture, Boolean fallbackToDefaultCulture)
   at Microsoft.Recognizers.Text.DateTime.DateTimeRecognizer.GetDateTimeModel(String culture, Boolean fallbackToDefaultCulture)
   at Microsoft.Recognizers.Text.DateTime.DateTimeRecognizer.RecognizeDateTime(String query, String culture, DateTimeOptions options, Nullable`1 refTime, Boolean fallbackToDefaultCulture)