c# wpf crash .net-4.7

c# - WPF COMException bloquea la aplicación en el inicio(comenzó hoy)



crash .net-4.7 (2)

Microsoft ha solucionado el problema con .NET 4.7 mientras tanto, consulte https://support.microsoft.com/en-US/help/4033488/comexception-error-from-wpf-applications-after-the-net-framework-4-7-i

Acabo de comenzar a ver esta Excepción en el mundo salvaje en el lanzamiento de la aplicación con una aplicación que ha estado en producción durante 3 años.

System.TypeInitializationException: The type initializer for ''MS.Win32.Penimc.UnsafeNativeMethods'' threw an exception. ---> System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) at MS.Win32.Penimc.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid) at MS.Win32.Penimc.UnsafeNativeMethods.CreatePimcManager() at MS.Win32.Penimc.UnsafeNativeMethods..cctor() --- End of inner exception stack trace --- at MS.Win32.Penimc.UnsafeNativeMethods.CreateResetEvent(IntPtr& handle) at System.Windows.Input.PenThreadWorker..ctor() at System.Windows.Input.PenThreadPool.GetPenThreadForPenContextHelper(PenContext penContext) at System.Windows.Input.PenThreadPool.GetPenThreadForPenContext(PenContext penContext) at System.Windows.Input.StylusWisp.WispTabletDeviceCollection.UpdateTabletsImpl() at System.Windows.Input.StylusWisp.WispTabletDeviceCollection.UpdateTablets() at System.Windows.Input.StylusWisp.WispTabletDeviceCollection..ctor() at System.Windows.Input.StylusWisp.WispLogic.get_WispTabletDevices() at System.Windows.Input.StylusWisp.WispLogic.RegisterHwndForInput(InputManager inputManager, PresentationSource inputSource) at System.Windows.Interop.HwndStylusInputProvider..ctor(HwndSource source) at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters) at System.Windows.Window.CreateSourceWindow(Boolean duringShow) at System.Windows.Window.CreateSourceWindowDuringShow() at System.Windows.Window.SafeCreateWindowDuringShow() at System.Windows.Window.ShowHelper(Object booleanBox) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at APSSSentinel.App.Main()

Aparentemente, algunos desarrolladores que usan VS2017 que obtuvieron una actualización de Windows que instaló .NET 4.7 también han tenido este bloqueo, parece que la solución recomendada por ahora es desactivar el soporte táctil.

https://developercommunity.visualstudio.com/content/problem/55303/visual-studio-may-terminate-unexpectedly-when-runn.html

Con mi aplicación, esto no es lo ideal. ¿Alguien más se ha encontrado con esto y ha encontrado algún otro tipo de solución?


Actualización: Microsoft ahora ha solucionado este problema en una actualización manual (como lo señaló Jürgen), personalmente seguiré con la solución hasta que la solución esté en la actualización automática porque sería mucho trabajo hacer que cada usuario instale una actualización manual .

Esto es obviamente un error en .Net 4.7 que afecta a los sistemas Windows 7 y 8 / 8.1 que tienen un dispositivo de entrada táctil. Por lo tanto, se puede esperar que Microsoft aborde esto en una futura actualización. Mientras tanto, la única forma de conservar la funcionalidad completa es mediante la desinstalación y ocultación de la actualización.

Otra opción es deshabilitar la compatibilidad con stylys y touch, ya sea en app.config (como en tu enlace) o en el código si la aplicación está compilada con 4.6 o más reciente. No especificó por qué eso no es lo ideal, pero supongo que esas funciones son necesarias. Tenga en cuenta que la desactivación no significa que todas las aplicaciones sean inutilizables con los dispositivos táctiles, sino que solo utilizan funciones a las que se puede acceder con un mouse. Actualización: al parecer, los usuarios de dispositivos táctiles sin un mouse tendrán problemas para utilizar la IU que requiere desplazamiento.

Aquí están los ejemplos de código para aquellos que vienen aquí buscando una solución rápida:

En App.config (funciona con aplicaciones compiladas con cualquier versión de framework)

<configuration> <runtime> <AppContextSwitchOverrides value="Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport=true" /> </runtime> </configuration>

En código (cuando se compila con .Net Framework> = 4.6)

protected override void OnStartup(StartupEventArgs e) { AppContext.SetSwitch("Switch.System.Windows.Input.Stylus.DisableStylusAndTouchSupport", true); base.OnStartup(e); }