更新到 MS KB4601050 后停靠工具窗口时,Visual Studio 2015 独立 Shell 应用程序崩溃

问题描述

我们有一个使用 .NET 4.8 和 Visual Studio 2015 Shell(隔离)开发的应用程序。在更新到 KB4601050 后,只要停靠工具窗口,此应用程序现在就会崩溃。

我已尝试按照知识库文章中的说明将开关添加到 app.config 文件中,但没有效果

<configuration>
   <runtime>
      <AppContextSwitchOverrides value="Switch.System.Windows.Interop.MouseInput.OptOutOfMovetochromedWindowFix=true; Switch.System.Windows.Interop.MouseInput.DoNotOptOutOfMovetochromedWindowFix=true" />
   </runtime>
</configuration>

我有什么选择来补救这种情况?

应用程序:xxxxx.exe 框架版本:v4.0.30319 描述:进程因未处理的异常而终止。 异常信息:System.NullReferenceException 在 System.Windows.Interop.HwndMouseInputProvider.HasCustomChrome(System.Windows.Interop.HwndSource,RECT ByRef) 在 System.Windows.Interop.HwndMouseInputProvider.GetEffectiveClientRect(IntPtr) 在 System.Windows.Interop.HwndMouseInputProvider.PossivelyDeactivate(IntPtr,Boolean) 在 System.Windows.Interop.HwndMouseInputProvider.dispose() 在 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr,MS.Internal.Interop.WindowMessage,IntPtr,Boolean ByRef) 在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr,Int32,Boolean ByRef) 在 MS.Win32.HwndWrapper.WndProc(IntPtr,Boolean ByRef) 在 MS.Win32.HwndSubclass.dispatcherCallbackOperation(System.Object) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate,System.Object,Int32) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object,System.Delegate,System.Delegate) 在 System.Windows.Threading.dispatcher.LegacyInvokeImpl(System.Windows.Threading.dispatcherPriority,System.TimeSpan,Int32) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr,IntPtr)

解决方法

虽然我无法通过将开关添加到 app.config 文件来解决问题,但将它们添加到注册表解决了问题。但是,请注意文章 https://docs.microsoft.com/en-us/dotnet/api/system.appcontext?view=netcore-3.1#remarks 中指出的注册表路径缺少 Microsoft 和 .NETFramework 之间的斜线。

,

我在使用 Visual Studio 2012 Express 时遇到了同样的问题。 我将您的 <AppContextSwitchOverrides>-Tag 添加到 WDExpress.exe.config 中的 <runtime>-部分(而不是 app.config,因为没有) C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

它就像一个魅力。