2014-12-05 110 views
1

獲取此異常的地址: 「Syncfusion.SfPdfViewer.WinRT.DLL中發生類型'System.FormatException'的第一個機會異常「在一個Windows商店應用程序項目中。Syncfusion.SfPdfViewer.WinRT.DLL中發生類型'System.FormatException'的第一個機會異常

它發生在我的主頁中,然後按導航到一個新的頁面,打開一個PDF然後回到主頁面,並再次按瓷磚打開相同的pdf 它不會發生,但是當它發生時,它會在第二次嘗試打開PDF時出現。

在我的PDF頁面

我有這個節

public PdfPage()   
{ 
    this.InitializeComponent(); 
    //NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled; 
    this.DataContext = this; 
} 



protected override async void OnNavigatedTo(NavigationEventArgs e) 
{ 
    base.OnNavigatedTo(e); 
    //DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait; 
    backButton.IsEnabled = false; 
    backButton.Visibility = Visibility.Collapsed; 
    document = e.Parameter as Document; 


    if (document.Source == SourceType.Join) 
    { 
     pdfTrace.Visibility = Visibility.Collapsed; 
     pdfShare.Visibility = Visibility.Collapsed; 

    } 


    var error = false; 
    try 
    { 


     await GetFile(); 


     //DispatcherTimerSetup(); 
     await Task.Delay(2000); 
     //await SetFileTraces("open", document.GetFullPath()); 
     backButton.IsEnabled = true; 
     backButton.Visibility = Visibility.Visible; 

    } 
    catch (FileNotFoundException e1) 
    { 
     Debug.WriteLine("pdfpage.cs 87 " + e1.Message); 
     error = true; 
    } 
    catch (Exception e1) 
    { 
     Debug.WriteLine("PDFpage.cs 90 " + e1.Message); 
     ShowMessageDialog("Connection Lost!"); 
     Frame.Navigate(typeof(LoginPage)); 
    } 

    if (error) 
    { 
     await new MessageDialog("The file does not exist!", "Error").ShowAsync(); 
     Frame.GoBack(); 
    } 

} 


private async Task GetFile() 
{ 
    try 
    { 
     backButton.IsEnabled = false; 
     //IsLoading = true; 

     var path = document.GetFullPath(); 
     byte[] bytes = null; 

     if (document.Source == Enums.SourceType.Join) 
     { 
      JoinService joinService = new JoinService(); 
      string nameNoExt = document.Name.Remove(document.Name.Length - 4, 4); 
      string handle = document.Handle; 
      bytes = await joinService.GetFileAsync(handle); 
      Debug.WriteLine("JOIN"); 
     } 
     else 
     { 
      bytes = await gappService.GetFileAsync(path); 

     } 

     pdfDocument = new PdfLoadedDocument(bytes); 
     pdfViewer.DocumentLoaded += (sender, e) => 
     { 
      try 
      { 
       pdfViewer.ViewMode = PageViewMode.FitWidth; 

      } 
      catch (Exception e1) 
      { 
       Debug.WriteLine("pdfpage.cs 128 " + e1.Message); 
      } 
     }; 
     pdfViewer.LoadDocument(pdfDocument); 


     backButton.IsEnabled = true; 
    } 
    catch (Exception e) 
    { 
     Debug.WriteLine("PDFPage 175 " + e.Message); 

    } 

} 

在我的輸出窗口,我得到

「類型‘System.FormatException’的第一次機會異常出現在Syncfusion.SfPdfViewer.WinRT.DLL pdfpage.cs 128輸入字符串格式不正確。「

在異常堆棧跟蹤

我有這個

在System.ThrowHelper.ThrowArgumentException(ExceptionResource 資源)在System.Collections.Generic.Dictionary 2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary 2.增加(TKEY的關鍵,TValue值)
在Syncfusion.Windows.PdfViewer.PdfDocumentView.IncludeCanvas(的Int32 的PageIndex,的Int32寬度,高度的Int32)在 Syncfusion.Windows.PdfViewer.PdfDocumentView.d__54.MoveNext() ---從先前位置)堆棧跟蹤其中例外在 System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore(拋出---在 System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__4(對象 狀態)

和我的異常消息爲:‘’使用Syncfusion 8.1控制爲值不在所述預期範圍內」,有時{「值沒有在預期範圍內。」}

IM。 WinRT XAML版本12.2.0.36 (它也是ap當我在模擬器中測試時會發生更多次的梨)

回答

1

試圖重新創建您的問題,在一頁中使用syncfusion PDFViewer控件在兩頁之間導航,它對我來說工作正常。

將此問題報告給Syncfusion支持並解決您的問題。您可以通過this link

聯繫Syncfusion支持
相關問題