Ejemplo n.º 1
0
        private void ProcessAssemblyDirective(IRootingServiceProvider rootProvider, XElement assemblyElement)
        {
            var assemblyNameAttribute = assemblyElement.Attribute("Name");
            if (assemblyNameAttribute == null)
                throw new Exception();

            ModuleDesc assembly = _context.ResolveAssembly(new AssemblyName(assemblyNameAttribute.Value));

            rootProvider.RootModuleMetadata(assembly, "RD.XML root");

            var dynamicDegreeAttribute = assemblyElement.Attribute("Dynamic");
            if (dynamicDegreeAttribute != null)
            {
                if (dynamicDegreeAttribute.Value != "Required All")
                    throw new NotSupportedException();

                foreach (TypeDesc type in ((EcmaModule)assembly).GetAllTypes())
                {
                    RootingHelpers.TryRootType(rootProvider, type, "RD.XML root");
                }
            }

            foreach (var element in assemblyElement.Elements())
            {
                switch (element.Name.LocalName)
                {
                    case "Type":
                        ProcessTypeDirective(rootProvider, assembly, element);
                        break;
                    default:
                        throw new NotSupportedException();
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessAssembly(string inputFile, IRootingServiceProvider rootProvider)
        {
            EcmaModule assembly;

            try
            {
                assembly = (EcmaModule)_context.ResolveAssembly(new AssemblyName(inputFile), false);
            }
            catch (TypeSystemException.BadImageFormatException)
            {
                // Native files can sometimes end up in the input. It would be nice if they didn't, but
                // it's pretty safe to just ignore them.
                // See: https://github.com/dotnet/corert/issues/2785
                return;
            }

            if (FrameworkStringResourceBlockingPolicy.IsFrameworkAssembly(assembly))
            {
                return;
            }

            rootProvider.RootModuleMetadata(assembly, "Application assembly root");

            foreach (TypeDesc type in assembly.GetAllTypes())
            {
                RdXmlRootProvider.RootType(rootProvider, type, "Application assembly root");
            }
        }
        private void ProcessAssembly(string inputFile, IRootingServiceProvider rootProvider)
        {
            EcmaModule assembly;

            try
            {
                // We use GetModuleFromPath because it's more resilient to slightly wrong inputs
                // (e.g. name of the file not matching the assembly name)
                assembly = _context.GetModuleFromPath(inputFile);
            }
            catch (TypeSystemException.BadImageFormatException)
            {
                // Native files can sometimes end up in the input. It would be nice if they didn't, but
                // it's pretty safe to just ignore them.
                // See: https://github.com/dotnet/corert/issues/2785
                return;
            }

            if (FrameworkStringResourceBlockingPolicy.IsFrameworkAssembly(assembly))
            {
                return;
            }

            rootProvider.RootModuleMetadata(assembly, "Application assembly root");

            foreach (TypeDesc type in assembly.GetAllTypes())
            {
                RdXmlRootProvider.RootType(rootProvider, type, "Application assembly root");
            }
        }
Ejemplo n.º 4
0
        private void ProcessAssembly(string inputFile, IRootingServiceProvider rootProvider)
        {
            var assembly = (EcmaModule)_context.ResolveAssembly(new AssemblyName(inputFile), false);

            if (FrameworkStringResourceBlockingPolicy.IsFrameworkAssembly(assembly))
            {
                return;
            }

            rootProvider.RootModuleMetadata(assembly, "Application assembly root");

            foreach (TypeDesc type in assembly.GetAllTypes())
            {
                RdXmlRootProvider.RootType(rootProvider, type, "Application assembly root");
            }
        }