File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,36 @@ public void ShowDialog_ResultWithMultiselect()
45
45
Assert . Equal ( tempFile . Path , dialog . FileName ) ;
46
46
}
47
47
48
+ // Regression test for https://github.com/dotnet/winforms/issues/12847
49
+ [ WinFormsFact ]
50
+ public void ShowDialog_Twice ( )
51
+ {
52
+ using OpenFileDialog dialog = new ( ) ;
53
+ using var tempFile = TempFile . Create ( 0 ) ;
54
+ dialog . Multiselect = true ;
55
+ dialog . InitialDirectory = Path . GetDirectoryName ( tempFile . Path ) ;
56
+ dialog . FileName = tempFile . Path ;
57
+
58
+ using RaceConditionDialogForm dialogOwnerForm = new ( dialog ) ;
59
+ Assert . Equal ( DialogResult . OK , dialog . ShowDialog ( dialogOwnerForm ) ) ;
60
+ }
61
+
62
+ private class RaceConditionDialogForm : AcceptDialogForm
63
+ {
64
+ private readonly OpenFileDialog _dialog ;
65
+
66
+ public RaceConditionDialogForm ( OpenFileDialog dialog )
67
+ {
68
+ _dialog = dialog ;
69
+ }
70
+
71
+ protected override void OnDialogIdle ( HWND dialogHandle )
72
+ {
73
+ Assert . Equal ( DialogResult . Cancel , _dialog . ShowDialog ( this ) ) ;
74
+ base . OnDialogIdle ( dialogHandle ) ;
75
+ }
76
+ }
77
+
48
78
private class AcceptDialogForm : DialogHostForm
49
79
{
50
80
protected override void OnDialogIdle ( HWND dialogHandle )
You can’t perform that action at this time.
0 commit comments