-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deterministic ordering of properties #1396
Comments
the serialization of classes should be consitent. that uses reflection. so what types are u verifying? yes SortPropertiesAlphabetically is global can u share a repro? |
I'm trying to create a stand alone repo, but can't seem to easily reproduce the behavior. I suspect the problem maybe lies in that NHiberate uses proxy objects that maybe does not always return properties in a deterministic way (which, if that is the case, then this is not a Verify issue). In the repo where we're actually experiencing problems, we have a large domain model and usually the problem only shows up when other tests have run first (unclear why that is).... but i will try to extend my smaller repo with more tests and see if i can get the problem to show up more reliably. |
I asked the same question at the NHibernate repo and it seems likely that it's an issue with the NHibernate dynamic proxies used for lazy loading. I will try to get more answers about possible work arounds there. |
The problem
While using Verify to verify objects that are loaded by
NHibernate
ORM (which by default uses lazy loading), the ordering of properties does not seem to be deterministic, but rather seem to depend on which objects are already loaded in cache and which are not. This can cause a lot of head scratching when something can seem to work the same way on a developer's machine, but not the same on the build server where properties may come in different order.Possible workarounds
A possible work around is to make sure entities are loaded before handing them off to Verify which is a bit cumbersome, but a possible solution.
Another work around is to globally set
VerifierSettings.SortPropertiesAlphabetically();
which will affect all tests (as far as i can understand)?Question
Is there another solution to this problem than my potential workarounds?
The text was updated successfully, but these errors were encountered: