English 中文(简体)
JavaScript 显示的银光错误, 不是视觉工作室
原标题:Silverlight errors showing in JavaScript, not Visual Studio

建立一个银光 5 应用程序, 它在浏览器中运行, 却在 JavaScript 中出现一些恶作剧错误, 这些错误不会被视觉工作室抓住, 因为调试器附加时有某种原因。 我做了简单的事情( 创建 VS SL 5 工程 w/ 网络工程 ) 。 当我调试时, 这些错误通过 JUS 出现在浏览器中... 而不是在视觉工作室中 。

我可以设置断点并走过这些断点, 但是当一个未处理的例外发生时, SL只是把它粘在页面上(如预期的), 但 VS没有抓住它。

我验证了 VS 附加到 IE 进程和 Type= Silverlight 。 现在, 我正在与的错误代码是“ 系统. argument 例外: 值并不在预期范围之内 ” 。 但是, 我找不到要发生在哪里 。 我得到的只是“ 视频工作室 JIT 调试器 ”, 它看起来非常像这个 < a href=> http://www.scottleckie.com/2010/04/ code-4004- unhandled- error- in- silverlight- application/" rel=“ nofollown" > http://www.scottledgeckie./2010/04/code-4004- unhandled- error- in- silverlight- application/ < / a >, 但他的解决方案对我行不通 。

最佳回答

Look in your App.xaml.cs and you will find a handler called Application_UnhandledException.
There should be some code similar to this:

    Deployment.Current.Dispatcher.BeginInvoke(delegate
    {
        ReportErrorToDOM(e);
    });

替换为自定义的错误处理方法 。
ReporErrorToDOM 是触发浏览器中 Javascript 错误的原因 。


如果你没有需要设置一个

public App()
{
    this.UnhandledException += this.Application_UnhandledException;
    ...
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
    // Handle exception here
    ...
    // Don t forget this !
    e.Handled = true;
}
问题回答

暂无回答




相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签