If you are either using the Json Serializer or some security features and you have .NET 3.5 RTM on a Vista or Windows Server 2008 machine, and you upgrade to SP2, you will hit one of the 4 exceptions below:
1]
System.Runtime.Serialization.SerializationException: ValueType 'System.Guid' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.UInt64' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.DateTime' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Int16' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Char' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Char' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Guid' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.SByte' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Single' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Decimal' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Int64' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.UInt32' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.TimeSpan' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Byte' cannot have ref to another object.
StackTrace:
System.Runtime.Serialization.SerializationException: ValueType 'System.Int32' cannot have ref to another object.
at ReadBasicClassFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] )
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlReader reader)
2] 'System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.'
3] System.Runtime.Serialization.SerializationException: An internal error has occurred. 'System.String' is not assignable from 'System.Int32' - error generating code for serialization.
at System.Runtime.Serialization.CodeGenerator.InternalConvert(Type source, Type target, Boolean isAddress)
at System.Runtime.Serialization.CodeGenerator.LoadParam(Object arg, Int32 oneBasedArgIndex, MethodBase methodInfo)
at System.Runtime.Serialization.CodeGenerator.Call(Object thisObj, MethodInfo methodInfo, Object param1, Object param2, Object param3, Object param4)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadValue(Type type, String name)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadMembers(ClassDataContract classContract, BitFlagsGenerator expectedElements, Label[] memberLabels, Label throwDuplicateMemberLabel, LocalBuilder memberIndexLocal)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadMembers(ClassDataContract classContract, LocalBuilder extensionDataLocal)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadClass(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.GenerateClassReader(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonClassDataContract.get_JsonFormatReaderDelegate()
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)
at Microsoft.CFx.Test.TestCases.AtlasIntegration.JsonSerializer.Functional.Basic.TestJsonConformanceOnRead.Run(IExecutionEngine ee)
4] System.NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetIdForInitialization(ClassDataContract classContract)
at System.Runtime.Serialization.DataContract.GetIdForInitialization(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.CreateObject(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.GenerateClassReader(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonClassDataContract.get_JsonFormatReaderDelegate()
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)
1]
System.Runtime.Serialization.SerializationException: ValueType 'System.Guid' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.UInt64' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.DateTime' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Int16' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Char' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Char' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Guid' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.SByte' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Single' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Decimal' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Int64' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.UInt32' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.TimeSpan' cannot have ref to another object.
System.Runtime.Serialization.SerializationException: ValueType 'System.Byte' cannot have ref to another object.
StackTrace:
System.Runtime.Serialization.SerializationException: ValueType 'System.Int32' cannot have ref to another object.
at ReadBasicClassFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] )
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlReader reader)
2] 'System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.'
3] System.Runtime.Serialization.SerializationException: An internal error has occurred. 'System.String' is not assignable from 'System.Int32' - error generating code for serialization.
at System.Runtime.Serialization.CodeGenerator.InternalConvert(Type source, Type target, Boolean isAddress)
at System.Runtime.Serialization.CodeGenerator.LoadParam(Object arg, Int32 oneBasedArgIndex, MethodBase methodInfo)
at System.Runtime.Serialization.CodeGenerator.Call(Object thisObj, MethodInfo methodInfo, Object param1, Object param2, Object param3, Object param4)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadValue(Type type, String name)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadMembers(ClassDataContract classContract, BitFlagsGenerator expectedElements, Label[] memberLabels, Label throwDuplicateMemberLabel, LocalBuilder memberIndexLocal)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadMembers(ClassDataContract classContract, LocalBuilder extensionDataLocal)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadClass(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.GenerateClassReader(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonClassDataContract.get_JsonFormatReaderDelegate()
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)
at Microsoft.CFx.Test.TestCases.AtlasIntegration.JsonSerializer.Functional.Basic.TestJsonConformanceOnRead.Run(IExecutionEngine ee)
4] System.NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetIdForInitialization(ClassDataContract classContract)
at System.Runtime.Serialization.DataContract.GetIdForInitialization(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.CreateObject(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.GenerateClassReader(ClassDataContract classContract)
at System.Runtime.Serialization.Json.JsonClassDataContract.get_JsonFormatReaderDelegate()
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)