New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The collection's state is no longer correct Exception #10
Comments
Could you please create a unit test to demonstrate the issue? |
The expression I am using is something as simple as the string "400 = 200", which I expect to return false. I have never been able to replicate the issue in a unit tests. I only see it in production, which makes me think there is a static collection somewhere in the code that is being shared by threads, but I have not been able to find it. |
I am starting to think this is a bug in .Net Core. I am going to update to Microsoft.AspNetCore.All 2.2.3 from 2.0.0 and see if the issue goes away. I did find a static Dictionary in the NCalc codebase that is likely what is throwing the exception. Without having spent too much time figuring out what this is for, I am wondering if this would be better handled with a ConcurrentDictionary, so the ReaderWriterLock would not need to be used.
|
Yes, that looks suspicious. |
I am also getting this error in production. It happens rarely and I have been unable to reproduce it in a dev/testing environment. Expressions are always simple. The most recent fail was evaluating 403 * -1 My suspicions have also been on the static dictionary. I will disable the cache, and it seems like that will stop using the static dictionary. |
@codermrrob we are now using a |
I randomly get this exception when calling Evaluate from the middleware of my ASP.Net Core web application. All I do is pass a string into the expression. I cannot think of any way that I can be affecting any collections in a non-concurrent way. Any suggestions?
Sometimes I get this error:
Sometimes the error looks like this:
The text was updated successfully, but these errors were encountered: