From 4813947b27fc061b96fb9027ec15bbea02455195 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Wed, 15 Feb 2017 13:49:49 -0800 Subject: [PATCH] Remove never defined FEATURE_SERIALIZATION Commit migrated from https://github.com/dotnet/coreclr/commit/b6c642a84e61fd81e8a4c779718d0e807f2aa6d2 --- .../src/mscorlib/src/System.Private.CoreLib.txt | 79 ------------------- .../src/System/Diagnostics/Contracts/Contracts.cs | 1 - .../System/Diagnostics/Contracts/ContractsBCL.cs | 1 - src/coreclr/src/vm/classnames.h | 4 - src/coreclr/src/vm/metasig.h | 5 -- src/coreclr/src/vm/mscorlib.h | 3 - src/coreclr/src/vm/object.h | 4 +- src/coreclr/src/vm/reflectioninvocation.cpp | 89 ---------------------- 8 files changed, 1 insertion(+), 185 deletions(-) diff --git a/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt b/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt index 2d49bb8..e45de2d 100644 --- a/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt +++ b/src/coreclr/src/mscorlib/src/System.Private.CoreLib.txt @@ -1575,85 +1575,6 @@ Serialization_DateTimeTicksOutOfRange = Invalid serialized DateTime data. Ticks ; The following serialization exception messages appear in native resources too (mscorrc.rc) Serialization_MemberOutOfRange = The deserialized value of the member "{0}" in the class "{1}" is out of range. -#if FEATURE_SERIALIZATION -Serialization_NoID = Object has never been assigned an objectID. -Serialization_UnknownMemberInfo = Only FieldInfo, PropertyInfo, and SerializationMemberInfo are recognized. -Serialization_UnableToFixup = Cannot perform fixup. -Serialization_NoType = Object does not specify a type. -Serialization_ValueTypeFixup = ValueType fixup on Arrays is not implemented. -Serialization_PartialValueTypeFixup = Fixing up a partially available ValueType chain is not implemented. -Serialization_InvalidID = Object specifies an invalid ID. -Serialization_DuplicateSelector = Selector is already on the list of checked selectors. -Serialization_NoBaseType = Object does not specify a base type. -Serialization_ArrayNoLength = Array does not specify a length. -Serialization_CannotGetType = Cannot get the type '{0}'. -Serialization_AssemblyNotFound = Unable to find assembly '{0}'. -Serialization_ArrayInvalidLength = Array specifies an invalid length. -Serialization_MalformedArray = The array information in the stream is invalid. -Serialization_MultipleMembers = Cannot resolve multiple members with the same name. -Serialization_ObjectUsedBeforeDeserCallback = An object was used before its deserialization callback ran, which may break higher-level consistency guarantees in the application. -Serialization_RegisterTwice = An object cannot be registered twice. -Serialization_IdTooSmall = Object IDs must be greater than zero. -Serialization_TooManyReferences = The implementation of the IObjectReference interface returns too many nested references to other objects that implement IObjectReference. -Serialization_NotISer = The given object does not implement the ISerializable interface. -Serialization_MissingKeyValuePairs = The KeyValuePairs for this Dictionary are missing. -Serialization_SurrogateCycleInArgument = Selector contained a cycle. -Serialization_SurrogateCycle = Adding selector will introduce a cycle. -Serialization_NeverSeen = A fixup is registered to the object with ID {0}, but the object does not appear in the graph. -Serialization_IORIncomplete = The object with ID {0} implements the IObjectReference interface for which all dependencies cannot be resolved. The likely cause is two instances of IObjectReference that have a mutual dependency on each other. -Serialization_NotCyclicallyReferenceableSurrogate = {0}.SetObjectData returns a value that is neither null nor equal to the first parameter. Such Surrogates cannot be part of cyclical reference. -Serialization_ObjectNotSupplied = The object with ID {0} was referenced in a fixup but does not exist. -Serialization_TooManyElements = The internal array cannot expand to greater than Int32.MaxValue elements. -Serialization_InvalidType = Only system-provided types can be passed to the GetUninitializedObject method. '{0}' is not a valid instance of a type. -Serialization_MissingObject = The object with ID {0} was referenced in a fixup but has not been registered. -Serialization_InvalidFixupType = A member fixup was registered for an object which implements ISerializable or has a surrogate. In this situation, a delayed fixup must be used. -Serialization_InvalidFixupDiscovered = A fixup on an object implementing ISerializable or having a surrogate was discovered for an object which does not have a SerializationInfo available. -Serialization_InvalidFormat = The input stream is not a valid binary format. The starting contents (in bytes) are: {0} ... -Serialization_ParentChildIdentical = The ID of the containing object cannot be the same as the object ID. -Serialization_IncorrectNumberOfFixups = The ObjectManager found an invalid number of fixups. This usually indicates a problem in the Formatter. -; The following serialization exception messages appear in native resources too (mscorrc.rc) -Serialization_NonSerType = Type '{0}' in Assembly '{1}' is not marked as serializable. -Serialization_ConstructorNotFound = The constructor to deserialize an object of type '{0}' was not found. - -; SerializationException used by Formatters -Serialization_ArrayType = Invalid array type '{0}'. -Serialization_ArrayTypeObject = Array element type is Object, 'dt' attribute is null. -Serialization_Assembly = No assembly information is available for object on the wire, '{0}'. -Serialization_AssemblyId = No assembly ID for object type '{0}'. -Serialization_BinaryHeader = Binary stream '{0}' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization. -Serialization_CrossAppDomainError = Cross-AppDomain BinaryFormatter error; expected '{0}' but received '{1}'. -Serialization_CorruptedStream = Invalid BinaryFormatter stream. -Serialization_HeaderReflection = Header reflection error: number of value members: {0}. -Serialization_ISerializableTypes = Types not available for ISerializable object '{0}'. -Serialization_ISerializableMemberInfo = MemberInfo requested for ISerializable type. -Serialization_MBRAsMBV = Type {0} must be marshaled by reference in this context. -Serialization_Map = No map for object '{0}'. -Serialization_MemberInfo = MemberInfo cannot be obtained for ISerialized Object '{0}'. -Serialization_Method = Invalid MethodCall or MethodReturn stream format. -Serialization_MissingMember = Member '{0}' in class '{1}' is not present in the serialized stream and is not marked with {2}. -Serialization_NoMemberInfo = No MemberInfo for Object {0}. -Serialization_ObjNoID = Object {0} has never been assigned an objectID. -Serialization_ObjectTypeEnum = Invalid ObjectTypeEnum {0}. -Serialization_ParseError = Parse error. Current element is not compatible with the next element, {0}. -Serialization_SerMemberInfo = MemberInfo type {0} cannot be serialized. -Serialization_Stream = Attempting to deserialize an empty stream. -Serialization_StreamEnd = End of Stream encountered before parsing was completed. -Serialization_TopObject = No top object. -Serialization_TopObjectInstantiate = Top object cannot be instantiated for element '{0}'. -Serialization_TypeCode = Invalid type code in stream '{0}'. -Serialization_TypeExpected = Invalid expected type. -Serialization_TypeMissing = Type is missing for member of type Object '{0}'. -Serialization_TypeRead = Invalid read type request '{0}'. -Serialization_TypeSecurity = Type {0} and the types derived from it (such as {1}) are not permitted to be deserialized at this security level. -Serialization_TypeWrite = Invalid write type request '{0}'. -Serialization_XMLElement = Invalid element '{0}'. -Serialization_Security = Because of security restrictions, the type {0} cannot be accessed. -Serialization_TypeLoadFailure = Unable to load type {0} required for deserialization. -Serialization_RequireFullTrust = A type '{0}' that is defined in a partially trusted assembly cannot be type forwarded from an assembly with a different Public Key Token or without a public key token. To fix this, please either turn on unsafeTypeForwarding flag in the configuration file or remove the TypeForwardedFrom attribute. -; The following serialization exception messages appear in native resources too (mscorrc.rc) -Serialization_TypeResolved = Type is not resolved for member '{0}'. -Serialization_MemberOutOfRange = The deserialized value of the member "{0}" in the class "{1}" is out of range. -#endif // FEATURE_SERIALIZATION ; ; StringBuilder Exceptions diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs index 93d6c48..4469bff 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs @@ -27,7 +27,6 @@ #else // CLR #define FEATURE_UNTRUSTED_CALLERS #define FEATURE_RELIABILITY_CONTRACTS -#define FEATURE_SERIALIZATION #endif using System; diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs index 5f4de4f..00c9c35 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs +++ b/src/coreclr/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs @@ -20,7 +20,6 @@ #else // CLR #define FEATURE_UNTRUSTED_CALLERS #define FEATURE_RELIABILITY_CONTRACTS -#define FEATURE_SERIALIZATION #endif using System; diff --git a/src/coreclr/src/vm/classnames.h b/src/coreclr/src/vm/classnames.h index 73d9853..0c24914 100644 --- a/src/coreclr/src/vm/classnames.h +++ b/src/coreclr/src/vm/classnames.h @@ -166,10 +166,6 @@ #define g_CriticalFinalizerObjectName "CriticalFinalizerObject" -#ifdef FEATURE_SERIALIZATION -#define g_StreamingContextName "StreamingContext" -#endif - #define g_AssemblySignatureKeyAttribute "System.Reflection.AssemblySignatureKeyAttribute" #endif //!__CLASSNAMES_H__ diff --git a/src/coreclr/src/vm/metasig.h b/src/coreclr/src/vm/metasig.h index a874a20..5933f64 100644 --- a/src/coreclr/src/vm/metasig.h +++ b/src/coreclr/src/vm/metasig.h @@ -526,11 +526,6 @@ DEFINE_METASIG(IM(Str_RetArrStr, s, a(s))) #endif //FEATURE_COMINTEROP // Object Clone -#ifdef FEATURE_SERIALIZATION -DEFINE_METASIG_T(IM(SerInfo_RetVoid, C(SERIALIZATION_INFO), v)) -DEFINE_METASIG_T(IM(SerInfo_StrContext_RetVoid, C(SERIALIZATION_INFO) g(STREAMING_CONTEXT), v)) -DEFINE_METASIG_T(SM(Obj_ArrStr_ArrObj_OutStreamingContext_RetSerializationInfo, j a(s) a(j) r(g(STREAMING_CONTEXT)), C(SERIALIZATION_INFO))) -#endif // FEATURE_SERIALIZATION DEFINE_METASIG(SM(Obj_OutStr_OutStr_OutArrStr_OutArrObj_RetObj, j r(s) r(s) r(a(s)) r(a(j)), j)) // Execution Context diff --git a/src/coreclr/src/vm/mscorlib.h b/src/coreclr/src/vm/mscorlib.h index 2e90c3b..d602dee 100644 --- a/src/coreclr/src/vm/mscorlib.h +++ b/src/coreclr/src/vm/mscorlib.h @@ -507,9 +507,6 @@ DEFINE_FIELD_U(_stackTraceString, ExceptionObject, _stackTraceString) DEFINE_FIELD_U(_remoteStackTraceString, ExceptionObject, _remoteStackTraceString) DEFINE_FIELD_U(_dynamicMethods, ExceptionObject, _dynamicMethods) DEFINE_FIELD_U(_xptrs, ExceptionObject, _xptrs) -#ifdef FEATURE_SERIALIZATION -DEFINE_FIELD_U(_safeSerializationManager, ExceptionObject, _safeSerializationManager) -#endif // FEATURE_SERIALIZATION DEFINE_FIELD_U(_HResult, ExceptionObject, _HResult) DEFINE_FIELD_U(_xcode, ExceptionObject, _xcode) DEFINE_FIELD_U(_remoteStackIndex, ExceptionObject, _remoteStackIndex) diff --git a/src/coreclr/src/vm/object.h b/src/coreclr/src/vm/object.h index 1702e8c..8f711cd 100644 --- a/src/coreclr/src/vm/object.h +++ b/src/coreclr/src/vm/object.h @@ -3748,9 +3748,7 @@ private: STRINGREF _remoteStackTraceString; PTRARRAYREF _dynamicMethods; STRINGREF _source; // Mainly used by VB. -#ifdef FEATURE_SERIALIZATION - OBJECTREF _safeSerializationManager; -#endif // FEATURE_SERIALIZATION + IN_WIN64(void* _xptrs;) IN_WIN64(UINT_PTR _ipForWatsonBuckets;) // Contains the IP of exception for watson bucketing INT32 _remoteStackIndex; diff --git a/src/coreclr/src/vm/reflectioninvocation.cpp b/src/coreclr/src/vm/reflectioninvocation.cpp index a116d2a..02c8891 100644 --- a/src/coreclr/src/vm/reflectioninvocation.cpp +++ b/src/coreclr/src/vm/reflectioninvocation.cpp @@ -1568,95 +1568,6 @@ Done: } FCIMPLEND -#ifdef FEATURE_SERIALIZATION -FCIMPL4(void, RuntimeMethodHandle::SerializationInvoke, - ReflectMethodObject *pMethodUNSAFE, Object* targetUNSAFE, Object* serializationInfoUNSAFE, struct StreamingContextData * pContext) { - FCALL_CONTRACT; - - struct _gc - { - OBJECTREF target; - OBJECTREF serializationInfo; - REFLECTMETHODREF refMethod; - } gc; - - gc.target = (OBJECTREF) targetUNSAFE; - gc.serializationInfo = (OBJECTREF) serializationInfoUNSAFE; - gc.refMethod = (REFLECTMETHODREF)ObjectToOBJECTREF(pMethodUNSAFE); - - MethodDesc* pMethod = pMethodUNSAFE->GetMethod(); - - Assembly *pAssem = pMethod->GetAssembly(); - - if (pAssem->IsIntrospectionOnly()) - FCThrowExVoid(kInvalidOperationException, IDS_EE_CODEEXECUTION_IN_INTROSPECTIVE_ASSEMBLY, NULL, NULL, NULL); - - if (pAssem->IsDynamic() && !pAssem->HasRunAccess()) - FCThrowResVoid(kNotSupportedException, W("NotSupported_DynamicAssemblyNoRunAccess")); - - HELPER_METHOD_FRAME_BEGIN_PROTECT(gc); - - { - ARG_SLOT newArgs[3]; - - // Nullable does not support the ISerializable constructor, so we should never get here. - _ASSERTE(!Nullable::IsNullableType(gc.target->GetMethodTable())); - - if (pMethod == MscorlibBinder::GetMethod(METHOD__WINDOWS_IDENTITY__SERIALIZATION_CTOR)) - { - // WindowsIdentity.ctor takes only one argument - MethodDescCallSite method(pMethod, &gsig_IM_SerInfo_RetVoid, &gc.target); - - // NO GC AFTER THIS POINT - // Copy "this" pointer: only unbox if type is value type and method is not unboxing stub - if (pMethod->GetMethodTable()->IsValueType() && !pMethod->IsUnboxingStub()) - newArgs[0] = PtrToArgSlot(gc.target->UnBox()); - else - newArgs[0] = ObjToArgSlot(gc.target); - - newArgs[1] = ObjToArgSlot(gc.serializationInfo); - - TryCallMethod(&method, newArgs); - } - else - { - // - // Use hardcoded sig for performance - // - MethodDescCallSite method(pMethod, &gsig_IM_SerInfo_StrContext_RetVoid, &gc.target); - - // NO GC AFTER THIS POINT - // Copy "this" pointer: only unbox if type is value type and method is not unboxing stub - if (pMethod->GetMethodTable()->IsValueType() && !pMethod->IsUnboxingStub()) - newArgs[0] = PtrToArgSlot(gc.target->UnBox()); - else - newArgs[0] = ObjToArgSlot(gc.target); - - newArgs[1] = ObjToArgSlot(gc.serializationInfo); - -#ifdef _WIN64 - // - // on win64 the struct does not fit in an ARG_SLOT, so we pass it by reference - // - static_assert_no_msg(sizeof(*pContext) > sizeof(ARG_SLOT)); - newArgs[2] = PtrToArgSlot(pContext); -#else // _WIN64 - // - // on x86 the struct fits in an ARG_SLOT, so we pass it by value - // - static_assert_no_msg(sizeof(*pContext) == sizeof(ARG_SLOT)); - newArgs[2] = *(ARG_SLOT*)pContext; -#endif // _WIN64 - - TryCallMethod(&method, newArgs); - } - } - - HELPER_METHOD_FRAME_END_POLL(); -} -FCIMPLEND -#endif // FEATURE_SERIALIZATION - struct SkipStruct { StackCrawlMark* pStackMark; MethodDesc* pMeth; -- 2.7.4