Excel 加载项抛出 SHException

发布于 2025-01-01 02:22:41 字数 1243 浏览 5 评论 0原文

我有一个 excel 插件,用 C#、.NET 35 SP1 编写 使用 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)

I have an excel addin, written in C#, .NET 35 SP1
using ExcelDNA, NetOffice
Occasionally clients reported my add-in disappear from Excel, I check it is in disabled addin list,
I enable it and it works again.
I checked my log and saw SHException. Not sure what causes and how to fix it. thanks

One thing I notice client has several other addins in Excel. Also has .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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

留一抹残留的笑 2025-01-08 02:22:41

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

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

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

thanks, Josh Christie. Found solution @ http://www.joshchristie.com/weblog/archives/2003_09.html

Call DoEvents after EnableVisualStyles
This bug in the 1.1 version of the .NET framework can, fortunately, be solved by calling Application.DoEvents() right after calling Application.EnableVisualStyles(). That's it, problem solved. :)

and Scott Hanselman
http://www.hanselman.com/blog/EnableVisualStylesStrikesAgain.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文