Skip to content

Error where adding a Required rule on an int property #4856

@pszittyay

Description

@pszittyay

Describe the bug
When adding a Required Rule on an int property the error is

Multiple constructors accepting all given argument types have been found in type 'Csla.LazySingleton1[System.Collections.Generic.Dictionary2[Csla.Core.IPropertyInfo,System.Object]]'. There should only be one applicable constructor.
Version and Platform
CSLA version: 8.2.9
OS: Windows.
Platform: WinForms, Net Framework 4.8

Code that Fails

BusinessRules.AddRule(new Required(XYZIntegerProperty, "Cannot be null"));

Stack Trace or Exception Detail
Microsoft.Extensions.DependencyInjection.ActivatorUtilities.TryFindMatchingConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor, Nullable1[]& parameterMap)
en Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor, Nullable1[]& matchingParameterMap)
en Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
en Csla.Server.DefaultDataPortalActivator.CreateInstance(Type requestedType, Object[] parameters)
en Csla.ApplicationContext.CreateInstanceDI(Type objectType, Object[] parameters)
en Csla.Rules.RuleContext..ctor(ApplicationContext applicationContext, Action1 completeHandler)
en Csla.Rules.BusinessRules.RunRules(IEnumerable1 rules, Boolean cascade, RuleContextModes executionContext)
en Csla.Rules.BusinessRules.CheckRulesForProperty(IPropertyInfo property, Boolean cascade, RuleContextModes executionMode)
en Csla.Rules.BusinessRules.CheckRules(IPropertyInfo property, RuleContextModes executionContext)
en Csla.Core.BusinessBase.CheckPropertyRules(IPropertyInfo property)
en Csla.Core.BusinessBase.SetProperty[P](PropertyInfo`1 propertyInfo, P newValue, NoAccessBehavior noAccess)

Additional context
The problem is resolve when the rule is comment out

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions