<small id='hb7vj'></small><noframes id='hb7vj'>

    1. <tfoot id='hb7vj'></tfoot><legend id='hb7vj'><style id='hb7vj'><dir id='hb7vj'><q id='hb7vj'></q></dir></style></legend>

          <bdo id='hb7vj'></bdo><ul id='hb7vj'></ul>
        <i id='hb7vj'><tr id='hb7vj'><dt id='hb7vj'><q id='hb7vj'><span id='hb7vj'><b id='hb7vj'><form id='hb7vj'><ins id='hb7vj'></ins><ul id='hb7vj'></ul><sub id='hb7vj'></sub></form><legend id='hb7vj'></legend><bdo id='hb7vj'><pre id='hb7vj'><center id='hb7vj'></center></pre></bdo></b><th id='hb7vj'></th></span></q></dt></tr></i><div id='hb7vj'><tfoot id='hb7vj'></tfoot><dl id='hb7vj'><fieldset id='hb7vj'></fieldset></dl></div>

      1. WPF COMException 在启动时使应用程序崩溃(今天开始)

        WPF COMException Crashes Application At Startup (Started Today)(WPF COMException 在启动时使应用程序崩溃(今天开始))

              • <bdo id='APiD2'></bdo><ul id='APiD2'></ul>
                <tfoot id='APiD2'></tfoot>

                <small id='APiD2'></small><noframes id='APiD2'>

              • <i id='APiD2'><tr id='APiD2'><dt id='APiD2'><q id='APiD2'><span id='APiD2'><b id='APiD2'><form id='APiD2'><ins id='APiD2'></ins><ul id='APiD2'></ul><sub id='APiD2'></sub></form><legend id='APiD2'></legend><bdo id='APiD2'><pre id='APiD2'><center id='APiD2'></center></pre></bdo></b><th id='APiD2'></th></span></q></dt></tr></i><div id='APiD2'><tfoot id='APiD2'></tfoot><dl id='APiD2'><fieldset id='APiD2'></fieldset></dl></div>

                  <tbody id='APiD2'></tbody>
                  <legend id='APiD2'><style id='APiD2'><dir id='APiD2'><q id='APiD2'></q></dir></style></legend>
                  本文介绍了WPF COMException 在启动时使应用程序崩溃(今天开始)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我今天刚刚开始在应用程序启动时看到这个异常,该应用程序已投入生产 3 年.

                  I have just today started seeing this Exception out in the wild on application launch with an app that has been in production for 3 years.

                  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()

                  显然,一些使用 VS2017 并获得安装了 .NET 4.7 的 Windows 更新的开发人员也遇到了此崩溃问题,目前建议的解决方法是关闭触控支持.

                  Apparently, some developers using VS2017 who got a Windows update that installed .NET 4.7 have been getting this crash as well, it appears the recommended workaround for now is to turn touch support off.

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

                  对于我的应用程序,这并不理想.有没有其他人遇到过这种情况,并找到了任何其他解决方法?

                  With my application, this is not ideal. Has anyone else run into this, and found any other sort of workaround?

                  推荐答案

                  更新:微软现已在 手动更新(如 Jürgen 所述),我个人会坚持使用该解决方法,直到自动更新修复,因为要让每个用户都安装手动更新会做很多工作.<小时>这显然是 .Net 4.7 中的一个错误,它会影响具有触摸输入设备的 Windows 7 和 8/8.1 系统.因此,人们可以希望微软在未来的更新中解决这个问题.同时,保留完整功能的唯一方法是卸载并隐藏更新.

                  Update: Microsoft has now fixed this problem in a manual update (as noted by Jürgen), personally I will stick with the workaround until the fix is in the automatic update because it would be a lot of work to make every user install a manual update.


                  This is obviously a bug in .Net 4.7 that affects Windows 7 and 8/8.1 systems that have a touch input device. Therefore one can hope that Microsoft addresses this in a future update. Meanwhile the only way to retain full functionality is by uninstalling and hiding the update.

                  如果应用程序是使用 4.6 或更高版本编译的,则其他选项是在 app.config(如您的链接中)或代码中禁用 stylys 和触摸支持.您没有具体说明为什么这不理想,但我认为需要这些功能?请注意,禁用并不意味着每个应用程序都无法通过触摸设备使用,而是它们仅使用可通过鼠标访问的功能.更新:显然,没有鼠标的触摸设备用户在使用需要滚动的 UI 时会遇到问题.

                  Other option is disabling the stylys and touch support either in app.config (like in your link) or in the code if the app is compiled with 4.6 or newer. You didn't specify why that is not ideal but I assume those features are needed? Notice that the disabling doesn't mean that every app is unusable with touch devices, but rather that they only use features that are accessible with a mouse. Update: Apparently touch device users without a mouse will have trouble using UI that requires scrolling.

                  这里是那些来这里寻求快速修复的人的代码示例:

                  Here's the code examples for those who come here seeking quick fix:

                  在 App.config 中(适用于使用任何框架版本编译的应用)

                  In App.config (works with apps compiled with any framework version)

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

                  在代码中(使用 .Net Framework >= 4.6 编译时)

                  In code (when compiled with .Net Framework >= 4.6)

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

                  这篇关于WPF COMException 在启动时使应用程序崩溃(今天开始)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Force JsonConvert.SerializeXmlNode to serialize node value as an Integer or a Boolean(强制 JsonConvert.SerializeXmlNode 将节点值序列化为整数或布尔值)
                  Using JSON to Serialize/Deserialize TimeSpan(使用 JSON 序列化/反序列化 TimeSpan)
                  Could not determine JSON object type for type quot;Classquot;(无法确定类型“Class的 JSON 对象类型.)
                  How to deserialize a JSONP response (preferably with JsonTextReader and not a string)?(如何反序列化 JSONP 响应(最好使用 JsonTextReader 而不是字符串)?)
                  how to de-serialize JSON data in which Timestamp it-self contains fields?(如何反序列化时间戳本身包含字段的JSON数据?)
                  JSON.Net custom contract serialization and Collections(JSON.Net 自定义合约序列化和集合)
                  • <small id='13ApM'></small><noframes id='13ApM'>

                    <i id='13ApM'><tr id='13ApM'><dt id='13ApM'><q id='13ApM'><span id='13ApM'><b id='13ApM'><form id='13ApM'><ins id='13ApM'></ins><ul id='13ApM'></ul><sub id='13ApM'></sub></form><legend id='13ApM'></legend><bdo id='13ApM'><pre id='13ApM'><center id='13ApM'></center></pre></bdo></b><th id='13ApM'></th></span></q></dt></tr></i><div id='13ApM'><tfoot id='13ApM'></tfoot><dl id='13ApM'><fieldset id='13ApM'></fieldset></dl></div>
                      <tbody id='13ApM'></tbody>
                      <legend id='13ApM'><style id='13ApM'><dir id='13ApM'><q id='13ApM'></q></dir></style></legend>

                    1. <tfoot id='13ApM'></tfoot>
                          <bdo id='13ApM'></bdo><ul id='13ApM'></ul>