XML DataContract Formatter can fail to write when instancetype != declaredType.

Issue #1081 - XML DataContract Formatter can fail to write when instancetype != declaredType.

Adding Functional tests for appropriate scenarios.