C# 类型为'的首次机会例外;System.FormatException';在Syncfusion.SfPdfViewer.WinRT.DLL中发生
我得到了这个例外: windows应用商店应用程序项目中的“Syncfusion.SfPdfViewer.WinRT.DLL”中出现“System.FormatException”类型的首次意外异常 当我在我的主页上点击一个互动程序导航到一个打开pdf的新页面,然后返回主页,再次点击互动程序打开同一个pdf时,就会发生这种情况 这种情况并非总是发生,但当它发生时,就是我第二次尝试打开pdf的时候 在我的pdf页面中,我有这个部分C# 类型为'的首次机会例外;System.FormatException';在Syncfusion.SfPdfViewer.WinRT.DLL中发生,c#,windows-runtime,windows-store-apps,syncfusion,C#,Windows Runtime,Windows Store Apps,Syncfusion,我得到了这个例外: windows应用商店应用程序项目中的“Syncfusion.SfPdfViewer.WinRT.DLL”中出现“System.FormatException”类型的首次意外异常 当我在我的主页上点击一个互动程序导航到一个打开pdf的新页面,然后返回主页,再次点击互动程序打开同一个pdf时,就会发生这种情况 这种情况并非总是发生,但当它发生时,就是我第二次尝试打开pdf的时候 在我的pdf页面中,我有这个部分 public PdfPage() {
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);
}
}
在我的输出窗口中,我得到
“Syncfusion.SfPdfViewer.WinRT.DLL中发生了类型为“System.FormatException”的第一次意外异常
pdfpage.cs 128输入字符串的格式不正确。“
在例外情况下,我有这个
"
在System.ThrowHelper.ThrowArgumentException(异常资源
资源)位于System.Collections.Generic.Dictionary2.Insert(TKey
键,T值,布尔值(加法)
System.Collections.Generic.Dictionary
2.Add(TKey,TValue)在Syncfusion.Windows.PdfViewer.PdfDocumentView.IncludeCanvas(Int32 页面索引、Int32宽度、Int32高度) Syncfusion.Windows.PdfViewer.PdfDocumentView.d_u54.MoveNext() ---来自引发异常的上一个位置的堆栈结束跟踪---在 System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__4(对象 国家)在 System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() " 我的异常消息是:“值不在预期范围内。”有时{“值不在预期范围内。”} im使用WinRT XAML版本12.2.0.36的Syncfusion 8.1控件
(当我在模拟器中进行测试时,这种情况似乎也会发生更多次)尝试在一个页面中使用syncfusion PDFViewer控件在两个页面之间导航,这对我来说很好 向Syncfusion支持部门报告此问题并解决您的问题。您可以通过以下方式与Syncfusion支持部门联系: