App Crash when moving window between screen while document is loading

I have two monitors, both with a different scaling factor applied. If I move an application between monitors that has a pdf viewer in it that is momentarily loading a pdf document the app crashes with this exception:

System.ArgumentOutOfRangeException

"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"

` at System.ThrowHelper.ThrowArgumentOutOfRange_IndexException() in E:\A\_work\159\s\src\mscorlib\src\System\ThrowHelper.cs:line 80

at Syncfusion.Windows.PdfViewer.SfPdfViewerControl.ChangeZoomFactorOnResizing()

at Syncfusion.Windows.PdfViewer.SfPdfViewerControl.d__70.MoveNext()

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in E:\A\_work\159\s\src\mscorlib\src\System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs:line 132

at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore() in C:\A\1\8\s\corefx\src\System.Runtime.WindowsRuntime\src\System\Threading\WindowsRuntimeSynchronizationContext.cs:line 213`


4 Replies

AV Ashokkumar Viswanathan Syncfusion Team August 25, 2021 01:48 PM UTC

Hi Doust, 
 
Greetings from Syncfusion support, 
 
We were unable to reproduce the reported issue, “Application crashes with argument exception when moving window between screen while document is loading  with the provided information. 
   
Please find the sample which we have tried to replicate the issue, 
 
Kindly share the following details to analyze more on this issue and assist you with the better solution     
1.       Replication video/ replication procedure illustrating the issue. 
2.       PDF document (if anything specific) 
3.       Simple sample/ modify the above provide if it is sample specific. 
4.       Device specification (OS , RAM, etc.) along with device resolution of two monitors. 
 
Could you please confirm whether the issue is occurring only when the app is dragged into the other monitor or performing another operation?. 
 
Regards, 
Ashok Kumar Viswanathan. 



ED E Doust August 28, 2021 02:00 PM UTC

Hello

going from your sample please do the following two things:

  1. upgrade to latest version of Syncfusion  v19.2.x
  2. do the following code changes:

a)
After pdfViewerGrid add an element that can be used to host a pdf viewer created in code

Snippet
<Grid x:Name="pdfViewerGrid" Grid.Row="1">
   <cc:SfPdfViewerControl x:Name="pdfViewer" />
</Grid>
<Border x:Name="PdfRoot" Grid.Row="1" />
b)
After pdfViewerGrid add an element that can be used to host a pdf viewer created in code

In the MainPage.xaml.cs add the following method to create a new pdf viewer

Snippet
private SfPdfViewerControl CreateNewPdfViewer()
{
    var viewer = new SfPdfViewerControl();
    viewer.ViewMode = PageViewMode.FitWidth;
    PdfRoot.Child = viewer;
    return viewer;
}
In the method OpenButton_Click, instead of loading a pdf to the existing pdf viewer control, load the document ldoc like this instead:
Snippet
var viewer = CreateNewPdfViewer();
PdfRoot.Child = viewer;
await viewer.LoadDocumentAsync(ldoc);

Comment out the loading into the existing pdf viewer:
Snippet
//pdfViewer.LoadDocument(ldoc);

For repro:

Start the app, prepare a document that takes a long time to render (complex pdf form), immediately after loading the document from the file open dialog drag the app window across monitor border

Then it crashes with the exception I wrote

My two monitors have this resolution:
1: 2560x1440 (Scaling: 100%)
2: 5120x2160 (Scaling: 150%)

Can't attach an image since the pdf is confidential and would be visible. If you provide a complex pdf form (like 50 text fields and dropdowns on one page I can test and make a video from that)


VD Vikram Devaraj Syncfusion Team August 30, 2021 11:49 AM UTC

Hi Doust,

 
Sorry for the inconvenience caused. We are preparing proper monitor environment in our end to reproduce your issue. After environment get ready we will update the further details on September 06, 2021. 
 

Regards,
Vikram




VD Vikram Devaraj Syncfusion Team September 6, 2021 10:56 AM UTC

Hi Doust,

We were still unable to reproduce the reported issue, “Application crashes with argument exception when moving window between screen while document is loading  with the provided information.  
    
Please find the sample which we have tried to replicate the issue,  
We suspect that this issue is due to particular PDF. Due to your PDF is confidential  we have created a private incident to share your PDF document if possible.

Please follow this Incident ID for this same issue:
https://www.syncfusion.com/support/directtrac/incidents/341667 
 
 
Regards,  
Vikram 


Loader.
Up arrow icon