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()); }
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>(); // Disable all PEVerification due to https://github.com/dotnet/roslyn/issues/6190 #if false foreach (var name in modulesToVerify) { var module = _modules[name]; 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; DumpAssemblyData(_modules.Values, out dumpDir); throw new PeVerifyException(errors.ToString(), dumpDir); } #endif return(allOutput.ToArray()); }