File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,13 +58,10 @@ private static void TryDelete(string path)
5858 private static void ConfigureGdal ( )
5959 {
6060 try {
61- if ( ! Environment . Is64BitProcess )
62- {
63- // Forces GDAL to run raster operations single-threaded by setting the <c>GDAL_NUM_THREADS</c>
64- // /// environment variable before any native GDAL/OCX module is loaded.
65- if ( string . IsNullOrEmpty ( Environment . GetEnvironmentVariable ( "GDAL_NUM_THREADS" ) ) )
66- Environment . SetEnvironmentVariable ( "GDAL_NUM_THREADS" , "1" ) ;
67- }
61+ // Forces GDAL to run raster operations single-threaded by setting the <c>GDAL_NUM_THREADS</c>
62+ // /// environment variable before any native GDAL/OCX module is loaded.
63+ if ( string . IsNullOrEmpty ( Environment . GetEnvironmentVariable ( "GDAL_NUM_THREADS" ) ) )
64+ Environment . SetEnvironmentVariable ( "GDAL_NUM_THREADS" , "1" ) ;
6865 } catch {
6966 // Ignore
7067 }
Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ protected override void WndProc(ref Message m)
8484 public void EnsureMapControlCreated ( )
8585 {
8686 CreateControl ( ) ;
87+
88+ // Force the FORM's own native window handle to exist even though it is never
89+ // shown. Control.CreateControl() is a no-op while the control is invisible, so
90+ // in headless mode the form otherwise has no handle. That makes the teardown in
91+ // WinFormsTestRunner.DisposeFormWhilePumping fall back to a synchronous
92+ // form.Dispose(), which destroys the child window (and performs the blocking
93+ // cross-apartment UIA disconnect in Control.ReleaseUiaProvider) outside any
94+ // active message pump - the deadlock observed as a hang on the 32-bit (x86)
95+ // test host. Creating the handle here guarantees the pumped BeginInvoke +
96+ // Application.Run teardown path is used instead, which services that call.
97+ _ = Handle ;
98+
8799 axMap1 . CreateControl ( ) ;
88100
89101 if ( ! axMap1 . IsHandleCreated )
You can’t perform that action at this time.
0 commit comments