Skip to content

Allow GetPermittedTriggers to Accept StronglyTyped Triggers with Guards in the Configurations#457

Open
WahidBitar wants to merge 9 commits into
dotnet-state-machine:devfrom
WahidBitar:dev
Open

Allow GetPermittedTriggers to Accept StronglyTyped Triggers with Guards in the Configurations#457
WahidBitar wants to merge 9 commits into
dotnet-state-machine:devfrom
WahidBitar:dev

Conversation

@WahidBitar

@WahidBitar WahidBitar commented Aug 15, 2021

Copy link
Copy Markdown

There is no need to throw an exception when trying to get the Permitted Triggers. If it's not valid just don't return it.
The previous behavior was throwing exceptions when you have different types of strongly typed triggers and you try to check the available triggers for one of them.
I've added a Test Case to cover the issue. #450

…ed Triggers. If it's not valid just don't return it.
@anatoly-kryzhanovsky

Copy link
Copy Markdown

i dont think that exception flow is good for normal behaviour.
exception is a slow mechanism, so we need to avoid them if we can

check my pull request - https://github.com/dotnet-state-machine/stateless/pull/451/files

@WahidBitar

Copy link
Copy Markdown
Author

@anatoly-kryzhanovsky Thanks, I realize the performance issue about using exceptions. But I didn't want to change the logic in the internal implementation. I'm not quite sure about the internal implementation, are you sure that your changes will not affect the behavior of other places in the library?

@anatoly-kryzhanovsky

Copy link
Copy Markdown

in old behavior in case of type mismatch exception will be throw and method will exit. in my code i added check for that case, no internal method was changed

@WahidBitar

Copy link
Copy Markdown
Author

@tlk May you check this, please

@WahidBitar

Copy link
Copy Markdown
Author

please!

@crozone

crozone commented Apr 12, 2023

Copy link
Copy Markdown
Collaborator

Looks good. This does remove the laziness of the IEnumerable<TTrigger> by building the HashSet<TTrigger> immediately but I don't think that matters much at all.

I guess it's just a question of whether we go with this option or #451

@WahidBitar

Copy link
Copy Markdown
Author

@mclift & @p-m-j may you review this please.

@p-m-j

p-m-j commented Aug 2, 2024

Copy link
Copy Markdown
Contributor

@WahidBitar - I haven't really looked at or thought about this project in years so I don't think I'm the right person to review, I don't think I ever really deserved membership of the org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants