In case when one command results in several events for the same AR those events could happen really fast, so DateTime.Utc.Now returns absolutely equal dates and two events get written with the same date to the EventStore. When they are queried later and sorted by EventDate the resulted order is unpredictable.
I faced this issue trying to replay events locally from our Dev db, there are two events
id: d85cd1d4-b0d0-4e7f-8d08-4b6e8638e61d, UserCreatedEvent, AggregateRootId: 42668cc6-da9e-44f1-ba05-105f55ebea34
id: 44b75b0c-cb43-482b-8b95-37b73ad1b0de, UserCredentialsCreatedEvent, AggregateRootId: 42668cc6-da9e-44f1-ba05-105f55ebea34
and they get returned in logically incorrect order UserCredentialsCreatedEvent first, since they have equal dates. I am not really sure how to solve this problem. Any thoughts?