类型为“System.FormatException”的第一次机会异常发生在Syncfusion.SfPdfViewer
本文关键字:异常 SfPdfViewer Syncfusion 机会 第一次 System FormatException 类型 | 更新日期: 2023-09-27 18:33:16
我收到此异常:"在 Windows 应用商店应用项目中的 Syncfusion.SfPdfViewer.WinRT.DLL 中发生了类型'System.FormatException'的第一次机会异常。
当 IM 在我的主页中,并按导航到打开 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中.DLLpdf页面.cs 128 输入字符串的格式不正确。
在异常堆栈跟踪中,我有这个
">
at System.ThrowHelper.ThrowArgumentException(ExceptionResource 资源( at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value(
at Syncfusion.Windows.PdfViewer.PdfDocumentView.IncludeCanvas(Int32 pageIndex, Int32 width, Int32 height( at Syncfusion.Windows.PdfViewer.PdfDocumentView.d__54.移动下一个(( --- 从引发异常的先前位置的堆栈跟踪结束 --- System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__4(对象 状态(在 System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore((
">
我的异常消息是:"值不在预期范围内",有时{"值不在预期范围内。
im 使用 WinRT XAML 版本 12.2.0.36 的同步 8.1 控件(当我在模拟器中进行测试时,它似乎也发生了更多次(
尝试重新创建您的问题以在一页中使用同步 PDFViewer 控件在两个页面之间导航,它对我来说工作正常。
向 Syncfusion 支持部门报告此问题并解决您的问题。您可以通过此链接联系同步支持人员