internal void GeneratePdb2Mdb(string directoryName) { logger.Trace(directoryName); IEnumerable <string> files = Directory.GetFiles(directoryName, "*.dll") .Concat(Directory.GetFiles(directoryName, "*.exe")) .Where(x => !x.Contains("vshost")); logger.Trace(files.Count()); var dirInfo = new DirectoryInfo(directoryName); Parallel.ForEach(files, file => { try { string fileNameWithoutExt = Path.GetFileNameWithoutExtension(file); string pdbFile = Path.Combine(Path.GetDirectoryName(file), fileNameWithoutExt + ".pdb"); if (File.Exists(pdbFile)) { logger.Trace("Generate mdp for: " + file); var procInfo = new ProcessStartInfo(MonoUtils.GetPdb2MdbPath(), Path.GetFileName(file)); procInfo.WorkingDirectory = dirInfo.FullName; Process proc = Process.Start(procInfo); proc.WaitForExit(); } } catch (Exception ex) { logger.Trace(ex); } }); logger.Trace("Transformed Debuginformation pdb2mdb"); }
public static void EnsurePdb2MdbCallWorks() { var platform = Environment.OSVersion.Platform; logger.Trace($"Platform={platform}, GetMonoPath={GetMonoPath()}, GetMonoXsp4={GetMonoXsp4()}, GetPdb2MdbPath={GetPdb2MdbPath()}"); var fileName = MonoUtils.GetPdb2MdbPath(); try { StartProcess(fileName, string.Empty); } catch (Exception ex) { logger.Info($"Can not find and run {fileName}! Calling {nameof(AddShellScriptToMonoApp)} ..."); if (!AddShellScriptToMonoApp()) { logger.Error(ex, $"Can not find and run {fileName}!"); } } }
private static bool AddShellScriptToMonoApp() { try { var libMonoApplicationPath = GlobalConfig.Current.LibMonoApplicationPath; if (string.IsNullOrWhiteSpace(libMonoApplicationPath) || !Directory.Exists(libMonoApplicationPath)) { logger.Error($"{nameof(AddShellScriptToMonoApp)}: Path {libMonoApplicationPath} from 'App.config/configuration/appSettings/{nameof(GlobalConfig.Current.LibMonoApplicationPath)}' not found!"); return(false); } var shellScriptInstallPath = GlobalConfig.Current.ShellScriptInstallPath; if (string.IsNullOrWhiteSpace(shellScriptInstallPath) || !Directory.Exists(shellScriptInstallPath)) { logger.Error($"{nameof(AddShellScriptToMonoApp)}: Path {shellScriptInstallPath} from 'App.config/configuration/appSettings/{nameof(GlobalConfig.Current.ShellScriptInstallPath)}' not found!"); return(false); } if (Environment.OSVersion.Platform == PlatformID.Unix) { AddShellScriptToMonoApp(libMonoApplicationPath, shellScriptInstallPath, MonoUtils.GetPdb2MdbPath()); AddShellScriptToMonoApp(libMonoApplicationPath, shellScriptInstallPath, MonoUtils.GetMonoXsp4()); } else { logger.Error($"Workaround for missing {MonoUtils.GetPdb2MdbPath()} is implemented only for unix (support for embedded linux)!"); } } catch (Exception ex) { logger.Error(ex, $"{nameof(AddShellScriptToMonoApp)} failed!"); return(false); } return(true); }