Metro JavaScript try / catch失败 [英] Metro JavaScript try/catch fails

查看:76
本文介绍了Metro JavaScript try / catch失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Metro JavaScript应用中遇到try / catch问题的其他人都失败了 - 即没有例外? 第一个症状是,如果你包含标准的jQuery,应用程序就会爆炸,因为jQuery依赖于一个正常运行的try / catch。 在winRT API对象上调用不存在的函数时,也无法
捕获异常。 我很惊讶我没有看到任何投诉,因为这是任何认真工作的完整显示。

Anyone else having problems with try/catch in a Metro JavaScript app failing - i.e. catching no exceptions?  The first symptom is that the app blows up if you include standard jQuery, as jQuery depends on a functioning try/catch.  Also fails to catch an exception when calling a non-existent function on a winRT API object.  I'm surprised I haven't seen any complaints, as this is a complete show-stopper for any serious work.

Visual Studio标准JavaScript窗口Metro风格固定布局项目。

Visual Studio standard JavaScript windows Metro Style Fixed Layout project.

Microsoft Visual Studio 11

版本11.0.40825.2 PREREL

Microsoft .NET Framework

版本4.5.65530 PREREL

已安装版本:Ultimate

Microsoft Visual C#11开发人员预览   01019-315-4422943-70030

Microsoft Visual Studio 11
Version 11.0.40825.2 PREREL
Microsoft .NET Framework
Version 4.5.65530 PREREL
Installed Version: Ultimate
Microsoft Visual C# 11 Developer Preview   01019-315-4422943-70030

推荐答案

嗨GlennW23,

Hi GlennW23,

您能否提供有关未被捕获的例外的更多详细信息?如果我在虚拟函数中的try / catch块中生成异常,它会按预期捕获。

Can you provide more details on the exceptions which aren't being caught? If I generate an exception in a try/catch block in a dummy function it gets caught as expected.

function button_click(e)
{
    try 
    {
        Debug.writeln("button_click");
        thisFunctionDoesNotExist();
     } 
    catch(ex)
    {
        Debug.writeln("caught exception: " + ex);
    }
}


很多人都在使用
jQuery在Metro风格的应用程序中成功
,因此您的特定情况可能会出现异常。

- Rob

Many people are using jQuery successfully in Metro style apps so there is likely something unusual about your specific scenario.

--Rob


这篇关于Metro JavaScript try / catch失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆