【问题标题】:Excel Add-In throws SHExceptionExcel 加载项引发 SHException
【发布时间】:2012-02-02 03:52:50
【问题描述】:

我有一个用 C#、.NET 35 SP1 编写的 excel 插件 使用 ExcelDNA、NetOffice 有时客户报告我的加载项从 Excel 中消失,我检查它是否在禁用的加载项列表中, 我启用它,它再次工作。 我检查了我的日志并看到了 SHException。不知道是什么原因以及如何解决它。谢谢

我注意到客户端在 Excel 中还有其他几个插件。还有.NET 1.1、.NET 2.0、.NET 3.0、NET 35 SP1

2012-01-31 07:10:12,672 [1] ERROR Shared.Helper [(null)] - Name:SEHException
Message:External component has thrown an exception.
Target:Int32 IntGetMessageW(System.Windows.Interop.MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32)
Stack:   at MS.Win32.UnsafeNativeMethods.IntGetMessageW(MSG& msg, HandleRef hWnd, Int32 uMsgFilterMin, Int32 uMsgFilterMax)
   at MS.Win32.UnsafeNativeMethods.GetMessageW(MSG& msg, HandleRef hWnd, Int32 uMsgFilterMin, Int32 uMsgFilterMax)
   at System.Windows.Threading.Dispatcher.GetMessage(MSG& msg, IntPtr hwnd, Int32 minMessage, Int32 maxMessage)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
   at System.Windows.Window.ShowDialog()
   at ExcelAddIn.Connect.ShowRefreshUI(Boolean checkForSettings, Boolean isRefreshAll)

【问题讨论】:

    标签: c# excel-addins excel-dna ribbonx


    【解决方案1】:

    谢谢,乔什·克里斯蒂。找到解决方案@http://www.joshchristie.com/weblog/archives/2003_09.html

    在 EnableVisualStyles 之后调用 DoEvents 幸运的是,可以通过在调用 Application.EnableVisualStyles() 之后立即调用 Application.DoEvents() 来解决 .NET 框架 1.1 版本中的这个错误。就这样,问题解决了。 :)

    和斯科特·汉塞尔曼 http://www.hanselman.com/blog/EnableVisualStylesStrikesAgain.aspx

    【讨论】:

      猜你喜欢
      • 2014-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-18
      相关资源
      最近更新 更多