Пример #1
0
        public string[] PeVerifyModules(string[] modulesToVerify, bool throwOnError = true)
        {
            // For Windows RT (ARM) THE CLRHelper.Peverify appears to not work and will exclude this
            // for ARM testing at present.
            StringBuilder errors    = new StringBuilder();
            List <string> allOutput = new List <string>();

            foreach (var name in modulesToVerify)
            {
                var assemblyData = _fullNameToAssemblyDataMap[name];
                if (assemblyData.Kind != Kind.ModuleData)
                {
                    continue;
                }

                var      module = assemblyData.ModuleData;
                string[] output = CLRHelpers.PeVerify(module.Image);
                if (output.Length > 0)
                {
                    if (modulesToVerify.Length > 1)
                    {
                        errors.AppendLine();
                        errors.AppendLine("<<" + name + ">>");
                        errors.AppendLine();
                    }

                    foreach (var error in output)
                    {
                        errors.AppendLine(error);
                    }
                }

                if (!throwOnError)
                {
                    allOutput.AddRange(output);
                }
            }

            if (throwOnError && errors.Length > 0)
            {
                string dumpDir;
                RuntimeUtilities.DumpAssemblyData(ModuleDatas, out dumpDir);
                throw new PeVerifyException(errors.ToString(), dumpDir);
            }
            return(allOutput.ToArray());
        }
Пример #2
0
 public string DumpAssemblyData(out string dumpDirectory)
 {
     return(RuntimeUtilities.DumpAssemblyData(ModuleDatas, out dumpDirectory));
 }