private string PreShowDialog() { MonoWorkarounds.EnsureRecentlyUsedValid(); string strPrevWorkDir = WinUtil.GetWorkingDirectory(); string strNew = Program.Config.Application.GetWorkingDirectory(m_strContext); if (!string.IsNullOrEmpty(m_strInitialDirectoryOvr)) { strNew = m_strInitialDirectoryOvr; } WinUtil.SetWorkingDirectory(strNew); // Always, even when no context try { string strWD = WinUtil.GetWorkingDirectory(); this.FileDialog.InitialDirectory = strWD; } catch (Exception) { Debug.Assert(false); } return(strPrevWorkDir); }