Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

ExecutePluginWith - output parameters without values #293

Open
Kraviecc opened this issue Mar 19, 2018 · 3 comments
Open

ExecutePluginWith - output parameters without values #293

Kraviecc opened this issue Mar 19, 2018 · 3 comments

Comments

@Kraviecc
Copy link
Contributor

Hi @jordimontana82,

probably there is a bug in method:
ExecutePluginWith<T>(ParameterCollection inputParameters, ParameterCollection outputParameters, EntityImageCollection preEntityImages, EntityImageCollection postEntityImages).

@eNeRGy164 committed in c484bf1 some changes to XrmFakedContext.Plugins (22.12.2017). I see he added, among others:
ctx.OutputParameters.AddRange(outputParameters).

It makes that when you pass outputParameters object to this method it will never return real output params from a custom action inside it. You can still use the overloaded version of this method where you pass your context built earlier.

Should I fix it by just changing AddRange to simply assignment?

@jordimontana82
Copy link
Owner

Thx for raising this @Kraviecc :)

@eNeRGy164 I'm wondering... why did you need the .AddRange() ? Maybe it was needed if you called multiple plugins with the same context when simulating the plugin execution pipeline? So it keeps adding output parameters?

@eNeRGy164
Copy link
Contributor

Will look into this tomorrow

@eNeRGy164
Copy link
Contributor

I changed it into AddRange because multiple ExecutePlugin methods stack onto each other, and they would override any inputparameters that were set earlier.
This is okay for input (props & images) but probably not for output props, so I may have refactored this incorrectly.
Seems we also need a unit test to cover this expected behaviour,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants