//This method is called from native code. If you update the signature, please also update //mscorlib.h and COMUtilNative.cpp internal static void FireCacheEvent() { BCLDebug.Trace("CACHE", "Called FileCacheEvent"); if (m_cacheHandler != null) { m_cacheHandler(null, null); m_cacheHandler = null; } }
private static void Log(bool test, string title, string success, string failure) { #if FEATURE_REMOTING if(test) BCLDebug.Trace("REMOTE", "{0}{1}", title, success); else BCLDebug.Trace("REMOTE", "{0}{1}", title, failure); #endif }
//This method is called from native code. If you update the signature, please also update //mscorlib.h and COMUtilNative.cpp internal static void FireCacheEvent() { BCLDebug.Trace("CACHE", "Called FileCacheEvent"); ClearCacheHandler handler = Interlocked.Exchange <ClearCacheHandler>(ref m_cacheHandler, null); if (handler != null) { handler(null, null); } }
internal UnitySerializationHolder(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } m_data = info.GetString("Data"); m_unityType = info.GetInt32("UnityType"); m_assemName = info.GetString("AssemblyName"); BCLDebug.Trace("SER", "UnitySerializationHolder: Retreiving [", m_data, "] with type: ", m_unityType, " in assembly: ", m_assemName); }
private void Trace(String name, int size, ConfigNodeSubType subType, ConfigNodeType nType, int terminal, [MarshalAs(UnmanagedType.LPWStr)] String text, int textLength, int prefixLength, int fEmpty) { BCLDebug.Trace("REMOTE", "Node " + name); BCLDebug.Trace("REMOTE", "text " + text); BCLDebug.Trace("REMOTE", "textLength " + textLength); BCLDebug.Trace("REMOTE", "size " + size); BCLDebug.Trace("REMOTE", "subType " + ((Enum)subType).ToString()); BCLDebug.Trace("REMOTE", "nType " + ((Enum)nType).ToString()); BCLDebug.Trace("REMOTE", "terminal " + terminal); BCLDebug.Trace("REMOTE", "prefixLength " + prefixLength); BCLDebug.Trace("REMOTE", "fEmpty " + fEmpty + "\n"); }
// ISerializable interface private RuntimeFieldHandle(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); } FieldInfo f = (RuntimeFieldInfo)info.GetValue("FieldObj", typeof(RuntimeFieldInfo)); if (f == null) { BCLDebug.Trace("SER", "[RuntimeFieldHandle.ctor]Null Type returned from GetValue."); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState")); } m_ptr = f.FieldHandle.m_ptr; if (m_ptr == (IntPtr)0) { throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState")); } }
// A helper method that returns the SerializationInfo that a class utilizing // UnitySerializationHelper should return from a call to GetObjectData. It contains // the unityType (defined above) and any optional data (used only for the reflection // types.) internal static void GetUnitySerializationInfo(SerializationInfo info, int unityType, String data, Assembly assem) { BCLDebug.Trace("SER", "UnitySerializationHolder: Adding [", data, "] with type: ", unityType); BCLDebug.Assert(info != null, "[UnitySerializationHolder.GetUnitySerializationInfo]info!=null"); info.SetType(typeof(UnitySerializationHolder)); info.AddValue("Data", data, typeof(String)); info.AddValue("UnityType", unityType); String assemName; if (assem == null) { assemName = String.Empty; } else { assemName = assem.FullName; } info.AddValue("AssemblyName", assemName); }
internal void Trace() { BCLDebug.Trace("REMOTE", "************ConfigNode************"); BCLDebug.Trace("REMOTE", "Name = " + m_name); if (m_value != null) { BCLDebug.Trace("REMOTE", "Value = " + m_value); } if (m_parent != null) { BCLDebug.Trace("REMOTE", "Parent = " + m_parent.Name); } for (int i = 0; i < m_attributes.Count; i++) { DictionaryEntry de = (DictionaryEntry)m_attributes[i]; BCLDebug.Trace("REMOTE", "Key = " + de.Key + " Value = " + de.Value); } for (int i = 0; i < m_children.Count; i++) { ((ConfigNode)m_children[i]).Trace(); } }
public void NotifyEvent(ConfigEvents nEvent) { BCLDebug.Trace("REMOTE", "NotifyEvent " + ((Enum)nEvent).ToString() + "\n"); }
private Delegate GetDelegate(DelegateEntry de) { Delegate d; if (de.methodName == null || de.methodName.Length == 0) { throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } Assembly assem = FormatterServices.LoadAssemblyFromString(de.assembly); if (assem == null) { BCLDebug.Trace("SER", "[DelegateSerializationHolder.ctor]: Unable to find assembly for TargetType: ", de.assembly); throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_AssemblyNotFound"), de.assembly)); } Type type = assem.GetTypeInternal(de.type, false, false, false); assem = FormatterServices.LoadAssemblyFromString(de.targetTypeAssembly); if (assem == null) { BCLDebug.Trace("SER", "[DelegateSerializationHolder.ctor]: Unable to find assembly for TargetType: ", de.targetTypeAssembly); throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_AssemblyNotFound"), de.targetTypeAssembly)); } Type targetType = assem.GetTypeInternal(de.targetTypeName, false, false, false); if (de.target == null && targetType == null) { throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } if (type == null) { BCLDebug.Trace("SER", "[DelegateSerializationHolder.GetRealObject]Missing Type"); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } if (targetType == null) { throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } Object target = null; if (de.target != null) //We have a delegate to a non-static object { target = RemotingServices.CheckCast(de.target, targetType); d = Delegate.CreateDelegate(type, target, de.methodName); } else { //For a static delegate d = Delegate.CreateDelegate(type, targetType, de.methodName); } // We will refuse to create delegates to methods that are non-public. MethodInfo mi = d.Method; if (mi != null) { if (!mi.IsPublic) { throw new SerializationException( Environment.GetResourceString("Serialization_RefuseNonPublicDelegateCreation")); } } return(d); }
// GetRealObject uses the data we have in m_data and m_unityType to do a lookup on the correct // object to return. We have specific code here to handle the different types which we support. // The reflection types (Assembly, Module, and Type) have to be looked up through their static // accessors by name. public virtual Object GetRealObject(StreamingContext context) { Assembly assem; BCLDebug.Trace("SER", "[GetRealObject] UnityType:", m_unityType); switch (m_unityType) { case EmptyUnity: BCLDebug.Trace("SER", "[GetRealObject]Returning Empty.Value"); BCLDebug.Trace("SER", "[GetRealObject]Empty's value is: ", Empty.Value, "||"); return(Empty.Value); case NullUnity: return(DBNull.Value); case MissingUnity: return(Missing.Value); case RuntimeTypeUnity: if (m_data == null || m_data.Length == 0 || m_assemName == null) { BCLDebug.Trace("SER", "UnitySerializationHolder.GetRealObject Type. Data is: ", m_data); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } if (m_assemName.Length == 0) { return(RuntimeType.GetTypeInternal(m_data, false, false, false)); } assem = FormatterServices.LoadAssemblyFromStringNoThrow(m_assemName); if (assem == null) { BCLDebug.Trace("SER", "UnitySerializationHolder.GetRealObject Type. AssemblyName is: ", m_assemName, " but we can't load it."); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } Type t = assem.GetTypeInternal(m_data, false, false, false); return(t); case ModuleUnity: if (m_data == null || m_data.Length == 0 || m_assemName == null) { BCLDebug.Trace("SER", "UnitySerializationHolder.GetRealObject Module. Data is: ", m_data); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } assem = FormatterServices.LoadAssemblyFromStringNoThrow(m_assemName); if (assem == null) { BCLDebug.Trace("SER", "UnitySerializationHolder.GetRealObject Module. AssemblyName is: ", m_assemName, " but we can't load it."); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } Module namedModule = assem.GetModule(m_data); if (namedModule == null) { throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFindModule")); } return(namedModule); case AssemblyUnity: if (m_data == null || m_data.Length == 0 || m_assemName == null) { BCLDebug.Log("UnitySerializationHolder.GetRealObject. Assembly. Data is: " + ((m_data == null)?"<null>":m_data)); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } assem = FormatterServices.LoadAssemblyFromStringNoThrow(m_assemName); if (assem == null) { BCLDebug.Trace("SER", "UnitySerializationHolder.GetRealObject Module. AssemblyName is: ", m_assemName, " but we can't load it."); throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientDeserializationState")); } return(assem); default: //This should never happen because we only use the class internally. throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUnity")); } }