Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# HtmlTextBlock:应用程序因无效html而崩溃_C#_Html_Windows Phone 7_Windows Phone 8 - Fatal编程技术网

C# HtmlTextBlock:应用程序因无效html而崩溃

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

我在WindowsPhone8应用程序中使用Krempel的WP7库

xaml

我无法处理try-catch中的异常。它处理得很好

  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();
            }
        }