SonyWWS / ATF

Authoring Tools Framework (ATF) is a set of C#/.NET components for making tools on Windows. ATF has been in continuous development in Sony Computer Entertainment's (SCE) Worldwide Studios central tools group since early 2005. ATF has been used by most SCE first party studios to make many custom tools such as Naughty Dog’s level editor and shader editor for The Last of Us, Guerrilla Games’ sequence editor for Killzone games (including the Killzone: Shadow Fall PS4 launch title), an animation blending tool at Santa Monica Studio, a level editor at Bend Studio, a visual state machine editor for Quantic Dream, sound editing tools, and many others.
Apache License 2.0
1.89k stars 262 forks source link

Issue with Validatior/TransactionContext system #62

Open danrafd opened 7 years ago

danrafd commented 7 years ago

Various validators can throw InvalidTransactionException during the IValidationContext.Ended event. However, at this point the HistoryContext override of OnEnded will already have logged the transaction and set the dirty flag. The exception is then thrown and the HistoryContext is now in an invalid state. This leads to documents being flagged as Dirty when they are in fact clean.

Perhaps validators should not throw during OnEnded - but during OnEnding instead. The transaction has supposedly ended and so it should not be possible to cancel it at that point.

There is a related issue here though in that some validators modify the Dom during OnEnding. This will mean that the order in which validators subscribe to the validation events is critical. Any modifications made to the Dom by a validator during OnEnding will not be validated by validators earlier in the subscription list.

It is possibly a mistake to mix the two different concepts of data validation and data coercion. Perhaps this issue could be worked around by separating the two - all 'Coercers' operate first then in a second pass, all Validators check the data consistency.

abeckus commented 7 years ago

Thank you for posting this issue and suggesting solutions. I will take a look at it for next update. Please keep the issue open. Alan