Skip to content

Commit 8559ad2

Browse files
Call SymSetParentWindow to ensure modal UI (#131)
In some cases, dbghelp / symsrv may pop up UI dialogs, such as to authenticate to a symbol server. We want those dialogs to be modal so that they are clearly visible to the user. Calling SymSetParentWindow ensures the modal nature of such possible UI elements.
1 parent a6186d8 commit 8559ad2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Engine/SafeNativeMethods.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,7 @@ internal static bool EstablishActivationContext() {
6262
[DllImport("dbghelp.dll")] public static extern bool SymCleanup(IntPtr hProcess);
6363

6464
[DllImport("dbghelp.dll", CharSet = CharSet.Unicode)] public static extern bool SymInitialize(IntPtr hProcess, [MarshalAs(UnmanagedType.LPWStr)] string UserSearchPath, bool fInvadeProcess);
65+
66+
[DllImport("dbghelp.dll")] public static extern bool SymSetParentWindow(IntPtr hWnd);
6567
}
6668
}

Engine/SymSrvHelpers.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public static List<string> GetFolderPathsForPDBs(StackResolver parent, string sy
2222
var retval = new List<string>();
2323
Contract.Requires(null != syms);
2424
Contract.Requires(null != parent);
25+
26+
if (!SafeNativeMethods.SymSetParentWindow(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle)) return retval;
27+
2528
if (!SafeNativeMethods.SymInitialize((IntPtr)(-1), symPath, false)) return retval;
2629
int progress = 0;
2730
foreach (var sym in syms) {

0 commit comments

Comments
 (0)