Im getting this exception:
"A first chance exception of type 'System.FormatException' occurred in Syncfusion.SfPdfViewer.WinRT.DLL"
it happens when im in my main page, and press a tile that navigates to a new page that opens a pdf then go back to main page, and press tile again to open the same pdf
it doesn't allways happen, but when it does, its when i try to open the pdf a second time.
in my pdf page i have this section
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);
}
}
in my output window i get
"A first chance exception of type 'System.FormatException' occurred in Syncfusion.SfPdfViewer.WinRT.DLL
pdfpage.cs 128 Input string was not in a correct format."
in the exception stacktrace i have this
"at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
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.<LoadPages>d__54.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__4(Object state)
at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()"
and my exception message is: ""Value does not fall within the expected range." and sometimes {"Value does not fall within the expected range."}
im using Syncfusion 8.1 Controls for WinRT XAML version 12.2.0.36