Dirkster99 / AvalonDock

Our own development branch of the well known WPF document docking library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regression causing taskbar application icon to flicker often

bdachev opened this issue · comments

Hi Dirk,
Hope all is well at your end!
We were chasing that anoying problem in our application. It happens quite often that application icon in taskbar flicker many times and what is more anoying application loses focus which causes menus or popups to get closed without a reason.
We traced down that to a change made in 96c6c89 and more precisely in source\Components\AvalonDock\Controls\Shell\SystemParameters2.cs.
The change causes that singleton Current is not initialized only once but each time it is referenced which in turn creates MessageWindow each time and that provokes the flickering and focus lost. I am not sure that change is made by purpose or wrong type of optimization but the old code works better for us.
If you are OK to revert that change I can create pull request.
Best regards,
Boris.

We're also seeing this with ILSpy: there's a whole bunch of MessageWindow instances getting created during startup.
These windows are visible in the taskbar (as flicking underlines without icon):
image

Stack trace of first MessageWindow creation
 # Child-SP          RetAddr               Call Site
00 0000002f`5bffb828 00007ff8`a361117e     USER32!CreateWindowExW
01 0000002f`5bffb830 00007ff8`a3611013     0x00007ff8`a361117e
02 0000002f`5bffb950 00007ff8`a360ff5f     AvalonDock!Standard.NativeMethods.CreateWindowEx+0x73
03 0000002f`5bffb9d0 00007ff8`a360e8f2     AvalonDock!Standard.MessageWindow..ctor+0x27f
04 0000002f`5bffbb60 00007ff8`a360e089     AvalonDock!Microsoft.Windows.Shell.SystemParameters2..ctor+0x132
05 0000002f`5bffbcb0 00007ff8`f0cb4e3d     AvalonDock!Microsoft.Windows.Shell.WindowChrome..ctor+0x109
06 0000002f`5bffbd40 00007ff8`f0cca91d     System_Private_CoreLib!System.RuntimeType.CreateInstanceDefaultCtor+0xbd [/_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @ 3753] 
07 0000002f`5bffbda0 00007ff8`f0cb4c30     System_Private_CoreLib!System.Activator.CreateInstance+0x3d [/_/src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs @ 100] 
08 0000002f`5bffbde0 00007ff8`f0cca6c5     System_Private_CoreLib!System.RuntimeType.CreateInstanceImpl+0x360 [/_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @ 3704] 
09 0000002f`5bffbea0 00007ff8`f0cca482     System_Private_CoreLib!System.Activator.CreateInstance+0x85 [/_/src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs @ 38] 
0a 0000002f`5bffbf00 00007ff8`f2405fb0     System_Private_CoreLib!System.Activator.CreateInstance+0x22 [/_/src/libraries/System.Private.CoreLib/src/System/Activator.cs @ 31] 
0b 0000002f`5bffbf40 00007ff8`f240acf0     System_Xaml!System.Xaml.Schema.SafeReflectionInvoker.CreateInstanceCritical+0x20 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/SafeReflectionInvoker.cs @ 189] 
0c 0000002f`5bffbf70 00007ff8`f2412d48     System_Xaml!System.Xaml.Schema.XamlTypeInvoker.CreateInstance+0x80 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XamlTypeInvoker.cs @ 141] 
0d 0000002f`5bffbfb0 00007ff8`f2412bcc     System_Xaml!MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor+0x28 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs @ 69] 
0e 0000002f`5bffbfe0 00007ff8`f23de1dc     System_Xaml!MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance+0x5c [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs @ 51] 
0f 0000002f`5bffc030 00007ff8`f23dca82     System_Xaml!System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart+0x21c [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs @ 1167] 
10 0000002f`5bffc0b0 00007ff8`f23f7bdc     System_Xaml!System.Xaml.XamlObjectWriter.WriteStartMember+0x322 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs @ 639] 
11 0000002f`5bffc100 00007ff8`dbc63f6d     System_Xaml!System.Xaml.XamlWriter.WriteNode+0xec [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlWriter.cs @ 46] 
12 0000002f`5bffc140 00007ff8`dbc639e2     PresentationFramework!System.Windows.Markup.WpfXamlLoader.TransformNodes+0x4cd [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/WpfXamlLoader.cs @ 247] 
13 0000002f`5bffc280 00007ff8`dbb107a4     PresentationFramework!System.Windows.Markup.WpfXamlLoader.Load+0x1f2 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/WpfXamlLoader.cs @ 148] 
14 0000002f`5bffc340 00007ff8`dbb0fd67     PresentationFramework!System.Windows.ResourceDictionary.CreateObject+0x94 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs @ 1385] 
15 0000002f`5bffc3a0 00007ff8`dbb0fc1d     PresentationFramework!System.Windows.ResourceDictionary.OnGettingValue+0xc7 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs @ 1035] 
16 0000002f`5bffc3f0 00007ff8`dbb0efcf     PresentationFramework!System.Windows.ResourceDictionary.OnGettingValuePrivate+0x5d [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs @ 997] 
17 0000002f`5bffc440 00007ff8`dbb0ef0e     PresentationFramework!System.Windows.ResourceDictionary.GetValueWithoutLock+0x4f [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs @ 508] 
18 0000002f`5bffc490 00007ff8`dbf10f04     PresentationFramework!System.Windows.ResourceDictionary.GetValue+0x5e [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs @ 492] 
19 0000002f`5bffc4f0 00007ff8`dbf10e76     PresentationFramework!System.Windows.ResourceDictionary.ResourceDictionaryEnumerator.System.Collections.IDictionaryEnumerator.get_Entry+0x44 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs @ 2105] 
1a 0000002f`5bffc550 00007ff8`a35f6972     PresentationFramework!System.Windows.ResourceDictionary.ResourceDictionaryEnumerator.System.Collections.IEnumerator.get_Current+0x26 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ResourceDictionary.cs @ 2082] 
1b 0000002f`5bffc590 00007ff8`a35f6ab3     ILSpy!ICSharpCode.ILSpy.Themes.ThemeManager.<UpdateTheme>g__ProcessDictionary|16_0+0x92 [C:\work\ILSpy\ILSpy\Themes\ThemeManager.cs @ 113] 
1c 0000002f`5bffc660 00007ff8`a35f6ab3     ILSpy!ICSharpCode.ILSpy.Themes.ThemeManager.<UpdateTheme>g__ProcessDictionary|16_0+0x1d3 [C:\work\ILSpy\ILSpy\Themes\ThemeManager.cs @ 120] 
1d 0000002f`5bffc730 00007ff8`a35f6ab3     ILSpy!ICSharpCode.ILSpy.Themes.ThemeManager.<UpdateTheme>g__ProcessDictionary|16_0+0x1d3 [C:\work\ILSpy\ILSpy\Themes\ThemeManager.cs @ 120] 
1e 0000002f`5bffc800 00007ff8`a35f6ab3     ILSpy!ICSharpCode.ILSpy.Themes.ThemeManager.<UpdateTheme>g__ProcessDictionary|16_0+0x1d3 [C:\work\ILSpy\ILSpy\Themes\ThemeManager.cs @ 120] 
1f 0000002f`5bffc8d0 00007ff8`a35f2c33     ILSpy!ICSharpCode.ILSpy.Themes.ThemeManager.<UpdateTheme>g__ProcessDictionary|16_0+0x1d3 [C:\work\ILSpy\ILSpy\Themes\ThemeManager.cs @ 120] 
20 0000002f`5bffc9a0 00007ff8`a35f29ad     ILSpy!ICSharpCode.ILSpy.Themes.ThemeManager.UpdateTheme+0x263 [C:\work\ILSpy\ILSpy\Themes\ThemeManager.cs @ 109] 
21 0000002f`5bffca60 00007ff8`a35f2949     ILSpy!ICSharpCode.ILSpy.Themes.ThemeManager.set_Theme+0x2d [C:\work\ILSpy\ILSpy\Themes\ThemeManager.cs @ 58] 
22 0000002f`5bffca90 00007ff8`a35ebdc7     ILSpy!ICSharpCode.ILSpy.SessionSettings.set_Theme+0x39 [C:\work\ILSpy\ILSpy\SessionSettings.cs @ 87] 
23 0000002f`5bffcac0 00007ff8`a35ea8bb     ILSpy!ICSharpCode.ILSpy.SessionSettings..ctor+0x867 [C:\work\ILSpy\ILSpy\SessionSettings.cs @ 67] 
24 0000002f`5bffce30 00007ff8`f0cb4e3d     ILSpy!ICSharpCode.ILSpy.MainWindow..ctor+0x11b [C:\work\ILSpy\ILSpy\MainWindow.xaml.cs @ 120] 
25 0000002f`5bffcfa0 00007ff8`f0cca91d     System_Private_CoreLib!System.RuntimeType.CreateInstanceDefaultCtor+0xbd [/_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @ 3753] 
26 0000002f`5bffd000 00007ff8`f0cb4c30     System_Private_CoreLib!System.Activator.CreateInstance+0x3d [/_/src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs @ 100] 
27 0000002f`5bffd040 00007ff8`f0cca6c5     System_Private_CoreLib!System.RuntimeType.CreateInstanceImpl+0x360 [/_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs @ 3704] 
28 0000002f`5bffd100 00007ff8`f0cca482     System_Private_CoreLib!System.Activator.CreateInstance+0x85 [/_/src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs @ 38] 
29 0000002f`5bffd160 00007ff8`f2405fb0     System_Private_CoreLib!System.Activator.CreateInstance+0x22 [/_/src/libraries/System.Private.CoreLib/src/System/Activator.cs @ 31] 
2a 0000002f`5bffd1a0 00007ff8`f240acf0     System_Xaml!System.Xaml.Schema.SafeReflectionInvoker.CreateInstanceCritical+0x20 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/SafeReflectionInvoker.cs @ 189] 
2b 0000002f`5bffd1d0 00007ff8`f2412d48     System_Xaml!System.Xaml.Schema.XamlTypeInvoker.CreateInstance+0x80 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XamlTypeInvoker.cs @ 141] 
2c 0000002f`5bffd210 00007ff8`f2412bcc     System_Xaml!MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor+0x28 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs @ 69] 
2d 0000002f`5bffd240 00007ff8`f23de1dc     System_Xaml!MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance+0x5c [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs @ 51] 
2e 0000002f`5bffd290 00007ff8`f23dca82     System_Xaml!System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart+0x21c [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs @ 1167] 
2f 0000002f`5bffd310 00007ff8`f23f7bdc     System_Xaml!System.Xaml.XamlObjectWriter.WriteStartMember+0x322 [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs @ 639] 
30 0000002f`5bffd360 00007ff8`dbc63f6d     System_Xaml!System.Xaml.XamlWriter.WriteNode+0xec [/_/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlWriter.cs @ 46] 
31 0000002f`5bffd3a0 00007ff8`dbc639e2     PresentationFramework!System.Windows.Markup.WpfXamlLoader.TransformNodes+0x4cd [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/WpfXamlLoader.cs @ 247] 
32 0000002f`5bffd4e0 00007ff8`dbc6373f     PresentationFramework!System.Windows.Markup.WpfXamlLoader.Load+0x1f2 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/WpfXamlLoader.cs @ 148] 
33 0000002f`5bffd5a0 00007ff8`dbc69ce8     PresentationFramework!System.Windows.Markup.WpfXamlLoader.LoadBaml+0x7f [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/WpfXamlLoader.cs @ 43] 
34 0000002f`5bffd600 00007ff8`dbadf94c     PresentationFramework!System.Windows.Markup.XamlReader.LoadBaml+0x2b8 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlReader.cs @ 1115] 
35 0000002f`5bffd680 00007ff8`dbadf7d8     PresentationFramework!System.Windows.Application.LoadBamlStreamWithSyncInfo+0xbc [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @ 575] 
36 0000002f`5bffd6f0 00007ff8`dbae19e4     PresentationFramework!System.Windows.Application.LoadComponent+0xc8 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @ 531] 
37 0000002f`5bffd740 00007ff8`dbae3866     PresentationFramework!System.Windows.Application.DoStartup+0x134 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @ 1524] 
38 0000002f`5bffd7a0 00007ff8`f26b73ad     PresentationFramework!System.Windows.Application.<.ctor>b__1_0+0x76 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @ 170] 
39 0000002f`5bffd7e0 00007ff8`f26b7242     WindowsBase!System.Windows.Threading.ExceptionWrapper.InternalRealCall+0xcd [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs @ 103] 
3a 0000002f`5bffd840 00007ff8`f26bdcae     WindowsBase!System.Windows.Threading.ExceptionWrapper.TryCatchWhen+0x32 [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs @ 36] 
3b 0000002f`5bffd890 00007ff8`f26bdb82     WindowsBase!System.Windows.Threading.DispatcherOperation.InvokeImpl+0x11e [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherOperation.cs @ 540] 
3c 0000002f`5bffd910 00007ff8`f265b687     WindowsBase!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext+0x22 [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherOperation.cs @ 489] 
3d 0000002f`5bffd940 00007ff8`f0dad699     WindowsBase!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper+0x37 [/_/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/CulturePreservingExecutionContext.cs @ 215] 
3e 0000002f`5bffd980 00007ff8`f0dad61f     System_Private_CoreLib!System.Threading.ExecutionContext.RunInternal+0x69 [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 183] 
3f 0000002f`5bffd9f0 00007ff8`f265b5d3     System_Private_CoreLib!System.Threading.ExecutionContext.Run+0xf [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 148] 
40 0000002f`5bffda20 00007ff8`f26bd9d2     WindowsBase!MS.Internal.CulturePreservingExecutionContext.Run+0xf3 [/_/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/CulturePreservingExecutionContext.cs @ 172] 
41 0000002f`5bffda70 00007ff8`f26ba805     WindowsBase!System.Windows.Threading.DispatcherOperation.Invoke+0x42 [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherOperation.cs @ 412] 
42 0000002f`5bffdad0 00007ff8`f26bad2a     WindowsBase!System.Windows.Threading.Dispatcher.ProcessQueue+0x265 [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs @ 2087] 
43 0000002f`5bffdb70 00007ff8`f2650667     WindowsBase!System.Windows.Threading.Dispatcher.WndProcHook+0x8a [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs @ 2296] 
44 0000002f`5bffdc10 00007ff8`f264f809     WindowsBase!MS.Win32.HwndWrapper.WndProc+0xa7 [/_/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/HwndWrapper.cs @ 295] 
45 0000002f`5bffdca0 00007ff8`f26b73ad     WindowsBase!MS.Win32.HwndSubclass.DispatcherCallbackOperation+0x79 [/_/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/HwndSubclass.cs @ 429] 
46 0000002f`5bffdcf0 00007ff8`f26b7242     WindowsBase!System.Windows.Threading.ExceptionWrapper.InternalRealCall+0xcd [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs @ 103] 
47 0000002f`5bffdd50 00007ff8`f26b935e     WindowsBase!System.Windows.Threading.ExceptionWrapper.TryCatchWhen+0x32 [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/Threading/ExceptionWrapper.cs @ 36] 
48 0000002f`5bffdda0 00007ff8`f264f5ab     WindowsBase!System.Windows.Threading.Dispatcher.LegacyInvokeImpl+0x17e [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs @ 1329] 
49 0000002f`5bffde40 00007ff8`a28732e0     WindowsBase!MS.Win32.HwndSubclass.SubclassWndProc+0x21b [/_/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/HwndSubclass.cs @ 341] 
4a 0000002f`5bffdf80 00007ff9`5ba4e7e8     0x00007ff8`a28732e0
4b 0000002f`5bffe000 00007ff9`5ba4e229     USER32!UserCallWinProcCheckWow+0x2f8
4c 0000002f`5bffe190 00007ff8`a35e88cb     USER32!DispatchMessageWorker+0x249
4d 0000002f`5bffe210 00007ff8`f26ba9ef     0x00007ff8`a35e88cb
4e 0000002f`5bffe2d0 00007ff8`f26b8362     WindowsBase!System.Windows.Threading.Dispatcher.PushFrameImpl+0xbf [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs @ 2135] 
4f 0000002f`5bffe360 00007ff8`f26b830e     WindowsBase!System.Windows.Threading.Dispatcher.PushFrame+0x42 [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs @ 329] 
50 0000002f`5bffe3a0 00007ff8`dbae37ad     WindowsBase!System.Windows.Threading.Dispatcher.Run+0x3e [/_/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/Dispatcher.cs @ 297] 
51 0000002f`5bffe3d0 00007ff8`dbae1e64     PresentationFramework!System.Windows.Application.RunDispatcher+0x1d [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @ 2405] 
52 0000002f`5bffe410 00007ff8`dbadef2c     PresentationFramework!System.Windows.Application.RunInternal+0x154 [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @ 1695] 
53 0000002f`5bffe470 00007ff8`a2852ace     PresentationFramework!System.Windows.Application.Run+0x2c [/_/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Application.cs @ 198] 
54 0000002f`5bffe4a0 00007ff9`023faed3     ILSpy!ICSharpCode.ILSpy.App.Main+0x5e
55 0000002f`5bffe4f0 00007ff9`023183b6     coreclr!CallDescrWorkerInternal+0x83
56 0000002f`5bffe530 00007ff9`0239f407     coreclr!MethodDescCallSite::CallTargetWorker+0x176 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp @ 551] 
57 (Inline Function) --------`--------     coreclr!MethodDescCallSite::Call+0xb [D:\a\_work\1\s\src\coreclr\vm\callhelpers.h @ 458] 
58 0000002f`5bffe660 00007ff9`0239f286     coreclr!RunMainInternal+0x11f [D:\a\_work\1\s\src\coreclr\vm\assembly.cpp @ 1483] 
59 0000002f`5bffe790 00007ff9`0239f135     coreclr!RunMain+0xd2 [D:\a\_work\1\s\src\coreclr\vm\assembly.cpp @ 1554] 
5a 0000002f`5bffe840 00007ff9`0239eef6     coreclr!Assembly::ExecuteMainMethod+0x1c9 [D:\a\_work\1\s\src\coreclr\vm\assembly.cpp @ 1672] 
5b 0000002f`5bffebd0 00007ff9`023b61e2     coreclr!CorHost2::ExecuteAssembly+0x1c6 [D:\a\_work\1\s\src\coreclr\vm\corhost.cpp @ 384] 
5c 0000002f`5bffed40 00007ff9`1282971b     coreclr!coreclr_execute_assembly+0xe2 [D:\a\_work\1\s\src\coreclr\dlls\mscoree\unixinterface.cpp @ 475] 
5d (Inline Function) --------`--------     hostpolicy!coreclr_t::execute_assembly+0x2a [D:\a\_work\1\s\src\native\corehost\hostpolicy\coreclr.cpp @ 89] 
5e 0000002f`5bffede0 00007ff9`12829a4c     hostpolicy!run_app_for_context+0x56b [D:\a\_work\1\s\src\native\corehost\hostpolicy\hostpolicy.cpp @ 255] 
5f 0000002f`5bffef80 00007ff9`1282a3e7     hostpolicy!run_app+0x3c [D:\a\_work\1\s\src\native\corehost\hostpolicy\hostpolicy.cpp @ 284] 
60 0000002f`5bffefc0 00007ff9`23ddb7e0     hostpolicy!corehost_main+0x107 [D:\a\_work\1\s\src\native\corehost\hostpolicy\hostpolicy.cpp @ 430] 
61 0000002f`5bfff170 00007ff9`23dde41a     hostfxr!execute_app+0x330 [D:\a\_work\1\s\src\native\corehost\fxr\fx_muxer.cpp @ 146] 
62 0000002f`5bfff270 00007ff9`23de06e6     hostfxr!`anonymous namespace'::read_config_and_execute+0xaa [D:\a\_work\1\s\src\native\corehost\fxr\fx_muxer.cpp @ 533] 
63 0000002f`5bfff370 00007ff9`23ddea84     hostfxr!fx_muxer_t::handle_exec_host_command+0x166 [D:\a\_work\1\s\src\native\corehost\fxr\fx_muxer.cpp @ 1018] 
64 0000002f`5bfff420 00007ff9`23dd85a3     hostfxr!fx_muxer_t::execute+0x494 [D:\a\_work\1\s\src\native\corehost\fxr\fx_muxer.cpp @ 579] 
65 0000002f`5bfff560 00007ff6`18cc24b8     hostfxr!hostfxr_main_startupinfo+0xb3 [D:\a\_work\1\s\src\native\corehost\fxr\hostfxr.cpp @ 61] 
66 0000002f`5bfff660 00007ff6`18cc282b     apphost!exe_start+0x8d8 [D:\a\_work\1\s\src\native\corehost\corehost.cpp @ 235] 
67 0000002f`5bfff830 00007ff6`18cc3cd8     apphost!wmain+0xab [D:\a\_work\1\s\src\native\corehost\corehost.cpp @ 304] 
68 (Inline Function) --------`--------     apphost!invoke_main+0x22 [d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 90] 
69 0000002f`5bfff860 00007ff9`5bd87614     apphost!__scrt_common_main_seh+0x10c [d:\a01\_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 
6a 0000002f`5bfff8a0 00007ff9`5c0426a1     KERNEL32!BaseThreadInitThunk+0x14
6b 0000002f`5bfff8d0 00000000`00000000     ntdll!RtlUserThreadStart+0x21

I'm not sure if multiple MessageWindow instances are necessary, but even if they are, I don't think they should be visible and focus-stealing. Normally invisible windows are used for similar purposes.

Looking at the SystemParameters2.cs code using this window, I guess it may need to be visible after all.
But I think even if the window itself is visible, it doesn't need to steal focus or appear on the taskbar.
I think WS_EX_NOACTIVATE could help with the taskbar issue; and the ShowWindow call could use SW_SHOWNOACTIVATE instead of SW_SHOW to avoid stealing the focus.