fix Issue 519 - Invariant not called from autogenerated class/struct constructor/destructor