1

We have an application that was developed using .NET 4.8 and the Visual Studio 2015 Shell (Isolated). This application is now crashing whenever a tool window is docked following the update to KB4601050.

I have tried adding the switches to the app.config file as indicated in the KB article, but it has no effect.

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

What options do I have to remedy this situation?

Application: xxxxx.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException at System.Windows.Interop.HwndMouseInputProvider.HasCustomChrome(System.Windows.Interop.HwndSource, RECT ByRef) at System.Windows.Interop.HwndMouseInputProvider.GetEffectiveClientRect(IntPtr) at System.Windows.Interop.HwndMouseInputProvider.PossiblyDeactivate(IntPtr, Boolean) at System.Windows.Interop.HwndMouseInputProvider.Dispose() at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

acordner
  • 193
  • 8
  • Could you try this workaround to check if it works? Set two AppContext switches using one of the methods described in AppContext Class (System) under the heading “AppContext for library consumers” . Please refer to [here](https://support.microsoft.com/en-us/topic/february-9-2021-kb4601050-cumulative-update-for-net-framework-3-5-and-4-8-for-windows-10-version-2004-windows-server-version-2004-windows-10-version-20h2-and-windows-server-version-20h2-7d61f856-72ce-7f4c-7e43-76f8aadf2aca) for more details. – DasiyTian_1203 Feb 15 '21 at 07:58
  • I was able to get this to work by setting up the registry keys. Adding the switches to the app,config file did not work. Just a note that the path to the registry keys in the linked article is incorrect. There should be a slash between Microsoft and .NETFramework. – acordner Feb 16 '21 at 16:59

2 Answers2

1

Although I was unable to resolve the issue by adding the switches to the app.config file, adding them to the registry resolved the issue. However, note that the registry path indicated in the article https://learn.microsoft.com/en-us/dotnet/api/system.appcontext?view=netcore-3.1#remarks is missing a slash between Microsoft and .NETFramework.

acordner
  • 193
  • 8
0

I had the same Problem with Visual Studio 2012 Express. I added your <AppContextSwitchOverrides>-Tag to the <runtime>-section in the WDExpress.exe.config (not to the app.config, because there was no) in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

It worked like a charm.

Biber
  • 709
  • 6
  • 19
  • I also add it to the file "VWDExpress.exe.config" (VS2012Express Web) and it worked also. – Biber Feb 17 '21 at 19:00