C# HtmlTextBlock:应用程序因无效html而崩溃
我在WindowsPhone8应用程序中使用Krempel的WP7库 xaml 我无法处理try-catch中的异常。它处理得很好C# HtmlTextBlock:应用程序因无效html而崩溃,c#,html,windows-phone-7,windows-phone-8,C#,Html,Windows Phone 7,Windows Phone 8,我在WindowsPhone8应用程序中使用Krempel的WP7库 xaml 我无法处理try-catch中的异常。它处理得很好 private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { Deb
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
Debugger.Break();
}
}
在设置避免引发异常的HtmlTextBlock之前,我是否可以验证html字符串?请尝试使用中的HtmlTextBlock
try
{
HtmlText.Html = "<a href=\"http://stackoverflow.com\">Stack Overflow</a>";
}
catch (Exception ex) { }
try
{
HtmlText.Html = "<a href=\"http://stackoverflow.com\"><br/></a>";
}
catch (Exception ex)
{
//not handled
}
Value does not fall within the expected range.
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
Debugger.Break();
}
}