zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
449 stars 86 forks source link

Exception on adding license #34

Closed ghost closed 6 years ago

ghost commented 6 years ago

Sometimes but not always we get an exception on adding the license when executing our unit tests.

System.NullReferenceException : Object reference not set to an instance of an object.
   at Z.Expressions.CompilerManager.?.?(Tuple`2 ?)
   at System.Collections.Generic.List`1.FindIndex(Int32 startIndex, Int32 count, Predicate`1 match)
   at Z.Expressions.CompilerManager.AddLicense(String licenseName, String licenseKey)

The test are all executed in parallel so it could be possible that the AddLicense method is executed multiple times.

Our code in the a base class looks like this:

if (!EvalManager.ValidateLicense()) {
    EvalManager.AddLicense("xxx", "xxx");
}
JonathanMagnan commented 6 years ago

Hello @curdincaspar ,

Are you adding the license in every unit test using our library?

Is it possible in your unit test to add the license in the config file? I believe that will solve your problem

Best Regards,

Jonathan

ghost commented 6 years ago

Hi @JonathanMagnan I think this solved the problem :) Thanks

JonathanMagnan commented 6 years ago

Great ;)