SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

Added order parameter to stepArgumentTransformation to prioritize execution

Open stbychkov opened this issue 1 year ago • 0 comments

What's changed

  • Added an optional Order parameter for StepArgumentTransformation to prioritize global type handlers effectively, ensuring they're considered last when needed.
  • Renamed StepTransformationTests file to StepArgumentTransformationTests as this change should've be done with this commit

In .NET 6 and earlier versions, the GetMethods method does not return methods in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which methods are returned, because that order varies. However, starting with .NET 7, the ordering is deterministic based upon the metadata ordering in the assembly.

(source)

Type.GetMethods is used to find all StepArgumentTransformation functions, but the order is not deterministic before .NET 7. This inconsistency made it tricky to handle type transformations, especially when setting up global handlers for optional parameters.

Types of changes

  • [x] New feature (non-breaking change which adds functionality).
  • [x] Other (docs, build config, etc)

Checklist:

  • [x] I've added tests for my code. (most of the time mandatory)
  • [x] I have added an entry to the changelog. (mandatory)
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.

stbychkov avatar Jun 15 '24 06:06 stbychkov