InitializeBusinessRules is marking the rules as Initialized before it is really initialized.
If a second thread reaches this method while the first thread is still loading the rules, you´ll get a error. To correct this error is necessary to put the line "rules.Initialized = true;" after "AddBusinessRules();":
private void InitializeBusinessRules()
{
var rules = BusinessRuleManager.GetRulesForType(this.GetType());
if (!rules.Initialized)
lock (rules)
if (!rules.Initialized)
{
rules.Initialized = true;
try
{
AddBusinessRules();
}
catch (Exception)
{
BusinessRuleManager.CleanupRulesForType(this.GetType());
throw; // and rethrow exception
}
rules.Initialized = true;
}
}
Thank you for finding this issue, I'll fix it in 4.3 and 4.5.
Copyright (c) Marimer LLC