Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

When .NET 3.5 is on box, Vista SP2 install breaks functionality


View products that this article applies to.

Symptoms

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)


↑ Back to the top


Cause

The cause for this is that .NET Framework 3.5 consists of 3 Framework layers: .NET 2.0 SP1, .NET 3.0 SP1, .NET 3.5 RTM.

When you upgrade to SP2, this will cause .NET 2.0 and .NET 3.0 to be upgrade to .NET 2.0 SP2 and .NET 3.0 SP2. However .NET 3.5 will remain at RTM version and not SP1 version. Therefore the versions are not consistent

↑ Back to the top


Resolution

Install .NET Framework 3.5 SP1

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2466909
Revision : 1
Created on : 1/7/2017
Published on : 4/12/2012
Exists online : False
Views : 821