nhibernate/nhibernate-core — pull request #56 by cremor (2012-01-13 11:59:24+00:00)
Title: NH-2880: Fixing Session and StatefulPersistenceContext deserialization

Deserialized proxies don't have a session attached because the code in StatefulPersistenceContext.OnDeserialization() doesn't work as expected. The same bug affects the enabled filters in SessionImpl.OnDeserialization().

Both classes uses Dictionaries (or classes that contain Dictionaries or Hashtables) and access them in OnDeserialization(). The problem is that the Dictionaries and Hashtables are not ready to use at this point of the deserialization (their OnDeserialization() method is called after the one of StatefulPersistenceContext/SessionImpl). This problem is described at many places, here are some of them:
http://connect.microsoft.com/VisualStudio/feedback/details/94265/generic-dictionary-ondeserialization-dependency-problem
http://stackoverflow.com/questions/457134/strange-behaviour-of-net-binary-serialization-on-dictionarykey-value
http://stackoverflow.com/questions/279524/hashtable-ondeserialization

This pull request contains the usual workaround: Calling OnDeserialization() for all Dictionaries
manually.

JIRA issue: https://nhibernate.jira.com/browse/NH-2880