Skip to content

Violated constraint during runtime with pipeline simulation from a plugin step without an instance #213

@SvenRahnSIT

Description

@SvenRahnSIT

I am using FakeXrmEasy v2.8.0.

When registering a plugin step without an instance like

context.RegisterPluginStep<Plugin1>(new PluginStepDefinition()
{
    MessageName = Plugins.Utils.Utils.MessageNames.Update,
    EntityLogicalName = Account.EntityLogicalName,
    Stage = FakeXrmEasy.Abstractions.Plugins.Enums.ProcessingStepStage.Postoperation,
});

and then causing the step to trigger with an update, FakeXrmEasy tries to build the method handle to ExecutePluginWith, which has the type parameter T with a constraint to IPlugin and new(). My plugin doesn't have an empty constructor, it only has the one with both config string parameters. This error is thrown during runtime:

System.ArgumentException: GenericArguments[0], 'Core.Plugins.Account.Plugin1', on 'Microsoft.Xrm.Sdk.IPlugin ExecutePluginWith[T](FakeXrmEasy.Pipeline.Scope.EventPipelineScope)' violates the constraint of type 'T'.

The CRM handles this just fine but FakeXrmEasy doesn't like it.

Please either handle this correctly while constructing the method handle or add a new() constraint on RegisterPluginStep to catch this during compilation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions