问题描述
Silverlight对象标签接受一个'onerror'参数,该参数调用您选择的一个javascript。 Visual Studio模板生成的默认实现组合了一个描述性的消息,并将其作为一个错误(即IE显示小警告三角形)将其抛出。
The silverlight object tag accept an 'onerror' parameter which calls back to a piece of javascript of your choice. The default implementation which is generated by the Visual Studio template assembles a descriptive message and throw it as an Error (which lets e.g. IE display the little warning triangle).
对我来说,每次这个回调被触发,我们的silverlight实例都已经死了,你需要刷新页面。这是一个合理的扣除吗?
It seems to me that each time this callback is fired our silverlight instance is dead and you need to refresh the page. Is this a reasonable deduction?
另一个问题是如何最好地处理这个回调。显示小警告图标有点以开发人员为中心,它不允许我们(开发人员)在客户机上运行时发现生产中实际失败的情况。人们在做什么?几个我们自己的(或多或少具体)的想法是:
Another issue is how to best handle this callback. Showing the little warning icon is somewhat developer-centric and it doesn't allow us (the developers) to discover what is actually failing in production when it is run on a customer machine. What are people doing with this? A couple of our own (more or less concrete) ideas are:
-
通过一些暴露的错误信息发送回服务器端点
Send the error message back to the server via some exposed endpoint
删除隐藏silverlight对象,向用户显示更好和更具描述性的消息以及刷新链接,以再次启动silverlight页面运行一个全尺寸的silverlight应用程序,所以如果silverlight对象不工作,客户也可以重新加载)
Remove hide the silverlight object, show a nicer and more descriptive message to the user and a 'refresh' link to start up the silverlight page again (we run a full-sized silverlight application so if the silverlight object isn't working, the customer might as well reload anyway)
想法,想法,最佳做法,反模式?你们做什么(除了确保silverlight应用程序永远不会失败,但这是另一个讨论)?
Ideas, thoughts, best practices, anti-patterns? What are you guys doing (except ensuring that the silverlight app never fails, but that's another discussion)?
推荐答案
我喜欢一个很好的使用SilverlightFX的表单形式的错误报告来源,检查出来非常酷的框架,否则基本上只是一个错误的总结,通过上传发送电子邮件支持的能力和哎呀我们goofed标题: )我以这种方式处理所有未处理的expetions,还有一篇很好的文章,通过类型使用字典处理错误
也是我的最爱我的
。希望这有助于
I like a nice error reporting in the form of a "form" using SilverlightFX grab the source http://github.com/NikhilK/silverlightfx/tree/master , check it out very cool framework otherwise basically would be just a summary of the error, the ability to send it via upload that emails to support and an "oops we goofed" title :) I handle all unhandled expetions in this way, there is also a nice article on handling the errors by type using a dictionaryhttp://www.netfxharmonics.com/2009/04/Exception-Handlers-for-Silverlight-20 also a favorite of mine. Hope this helps
这篇关于处理Silverlight onerror回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!