Inheritance: System.Reflection.Assembly
Exemple #1
0
 internal static extern void PublishAnonymouslyHostedDynamicMethodsAssembly(RuntimeAssembly assemblyHandle);
Exemple #2
0
        // Token: 0x06001561 RID: 5473 RVA: 0x0003E7A0 File Offset: 0x0003C9A0
        internal static void GetUnitySerializationInfo(SerializationInfo info, int unityType, string data, RuntimeAssembly assembly)
        {
            info.SetType(typeof(UnitySerializationHolder));
            info.AddValue("Data", data, typeof(string));
            info.AddValue("UnityType", unityType);
            string value;

            if (assembly == null)
            {
                value = string.Empty;
            }
            else
            {
                value = assembly.FullName;
            }
            info.AddValue("AssemblyName", value);
        }
Exemple #3
0
        [System.Security.SecurityCritical]  // auto-generated
        static internal ObjectHandle CreateInstance(String assemblyString,
                                                    String typeName,
                                                    bool ignoreCase,
                                                    BindingFlags bindingAttr,
                                                    Binder binder,
                                                    Object[] args,
                                                    CultureInfo culture,
                                                    Object[] activationAttributes,
                                                    Evidence securityInfo,
                                                    ref StackCrawlMark stackMark)
        {
#if FEATURE_CAS_POLICY
            if (securityInfo != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
            {
                throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
            }
#endif // FEATURE_CAS_POLICY
            Type     type     = null;
            Assembly assembly = null;
            if (assemblyString == null)
            {
                assembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark);
            }
            else
            {
                RuntimeAssembly assemblyFromResolveEvent;
                AssemblyName    assemblyName = RuntimeAssembly.CreateAssemblyName(assemblyString, false /*forIntrospection*/, out assemblyFromResolveEvent);
                if (assemblyFromResolveEvent != null)
                {
                    // Assembly was resolved via AssemblyResolve event
                    assembly = assemblyFromResolveEvent;
                }
                else if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime)
                {
                    // WinRT type - we have to use Type.GetType
                    type = Type.GetType(typeName + ", " + assemblyString, true /*throwOnError*/, ignoreCase);
                }
                else
                {
                    // Classic managed type
                    assembly = RuntimeAssembly.InternalLoadAssemblyName(
                        assemblyName, securityInfo, null, ref stackMark,
                        true /*thrownOnFileNotFound*/, false /*forIntrospection*/, false /*suppressSecurityChecks*/);
                }
            }

            if (type == null)
            {
                // It's classic managed type (not WinRT type)
                Log(assembly != null, "CreateInstance:: ", "Loaded " + assembly.FullName, "Failed to Load: " + assemblyString);
                if (assembly == null)
                {
                    return(null);
                }

                type = assembly.GetType(typeName, true /*throwOnError*/, ignoreCase);
            }

            Object o = Activator.CreateInstance(type,
                                                bindingAttr,
                                                binder,
                                                args,
                                                culture,
                                                activationAttributes);

            Log(o != null, "CreateInstance:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName);
            if (o == null)
            {
                return(null);
            }
            else
            {
                ObjectHandle Handle = new ObjectHandle(o);
                return(Handle);
            }
        }
Exemple #4
0
        static internal ObjectHandle CreateInstance(String assemblyString,
                                                    String typeName,
                                                    bool ignoreCase,
                                                    BindingFlags bindingAttr,
                                                    Binder binder,
                                                    Object[] args,
                                                    CultureInfo culture,
                                                    Object[] activationAttributes,
                                                    Evidence securityInfo,
                                                    ref StackCrawlMark stackMark)
        {
            Type     type     = null;
            Assembly assembly = null;

            if (assemblyString == null)
            {
                assembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark);
            }
            else
            {
                RuntimeAssembly assemblyFromResolveEvent;
                AssemblyName    assemblyName = RuntimeAssembly.CreateAssemblyName(assemblyString, false /*forIntrospection*/, out assemblyFromResolveEvent);
                if (assemblyFromResolveEvent != null)
                {
                    // Assembly was resolved via AssemblyResolve event
                    assembly = assemblyFromResolveEvent;
                }
                else if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime)
                {
                    // WinRT type - we have to use Type.GetType
                    type = Type.GetType(typeName + ", " + assemblyString, true /*throwOnError*/, ignoreCase);
                }
                else
                {
                    // Classic managed type
                    assembly = RuntimeAssembly.InternalLoadAssemblyName(
                        assemblyName, securityInfo, null, ref stackMark,
                        true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
                }
            }

            if (type == null)
            {
                // It's classic managed type (not WinRT type)
                Log(assembly != null, "CreateInstance:: ", "Loaded " + assembly.FullName, "Failed to Load: " + assemblyString);
                if (assembly == null)
                {
                    return(null);
                }

                type = assembly.GetType(typeName, true /*throwOnError*/, ignoreCase);
            }

            Object o = Activator.CreateInstance(type,
                                                bindingAttr,
                                                binder,
                                                args,
                                                culture,
                                                activationAttributes);

            Log(o != null, "CreateInstance:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName);
            if (o == null)
            {
                return(null);
            }
            else
            {
                ObjectHandle Handle = new ObjectHandle(o);
                return(Handle);
            }
        }