We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Automationid may only be set one time.

I have a navigation drawer with a list of PDF files.
When I select an item from the list view, I do pdfViewerControl.Unload(); and then reload the new one with

fileStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream(string.Format("MyRestaurant.Assets.{0}",menuname));
//Load the PDF

The first time this happens it loads the PDF file with no problem. Choose another from the menu and I get the error message - any ideas?



8 Replies

GR Gayathri Ramalingam Syncfusion Team August 27, 2019 08:10 AM

Hi Pete,  
We have tried to reproduce the issue “Application crashes while loading PDF document after unloading PDF Viewer”, but it is working fine as expected. Kindly refer the sample in the below link which we created to reproduce the reported issue.  
Kindly share the following details to analyze more on this issue and it will be helpful for us to analyze more on this issue.  
1.       Modify / Simple sample with which the issue could be reproduced.  
2.       Replication procedure to reproduce the issue or screen shot illustrating the issue.  
3.       Android / iOS device specification with the OS version.  
4.       PDF document with which the issue could be reproduced. 
5.       Xamarin.Froms version. 
6.       SfPdfViewer version. 
With Regards, 
Gayathri R 

PV Pete Vickers August 27, 2019 10:24 AM

I downloaded that sample and the third time I pressed load I got the error I had (screenshot attached)



Attachment: pdfErrorSF_38d1041.zip

PV Pete Vickers August 28, 2019 02:22 AM

I have disabled the tool bar and all works fine now


GR Gayathri Ramalingam Syncfusion Team August 28, 2019 03:59 AM

Hi Pete, 
Thank you for your update. We are glad to know that the issue is resolved. 
With Regards, 
Gayathri R 

SK Santosh Kumar March 16, 2023 01:31 AM

Hi Syncfusion team,

I have the same problem as Pete and his solution of hiding the toolbar works for me. It means that I cannot use the features provided in the toolbar. For example, I cannot have the user to save or search through the document.

Reproducing this is fairly easy:

  1. have a button and a pdfviewer on a page. Set the istoolbarivisible property of the pdfviewer to true.
  2. On the button's click event, load the pdfviewer pdf document.
  3. Once the document is loaded. click the button again. The error will popup.



MA ManojKumar Arumugasamy Syncfusion Team March 17, 2023 03:06 AM

Hi Santosh, we suspect the reported issue is replicate only with specific device or when the accessibility mode is enabled. Could you try after disabling the accessibility mode?. However, the "System.InvalidOperationException: AutomationId may only be set one time." issue is related to Xamarin.Forms and already the same issue logged in below forum. 


We already have feedback for your issue. You can track the status of reported bug from below feedback link,
[Android] System.InvalidOperationException: AutomationId may only be set one-time in Xamarin.Forms | Feedback Portal (syncfusion.com)

SK Santhosh Kumar March 17, 2023 03:35 AM

Hi Manoj,

The accessibility mode is already switched off on my device. 

it doesn't help even if I enable it and disable it again. Disabling accessibility may be a workaround but not the solution. 

It is not possible to have all the users to disable accessibility on their devices. The bug report link says that a patch would be released in November 2021. Was it released? I'm using version

Let me know if there is any other way to overcome this until it is fixed permanently. I would need the save functionality from the toolbar more than the other.



MA ManojKumar Arumugasamy Syncfusion Team March 20, 2023 01:23 AM

Hi Santosh, we have further analyzed and confirmed that the issue is related to Xamarin.Forms side by December 2021. We have found that the same issue is logged in the github,

Question: AutomationId may only be set one time - Bug or Feature? · Issue #6157 · xamarin/Xamarin.Forms (github.com)


Could you try using a custom toolbar instead of the built-in toolbar? The documentation for the custom toolbar is provided in the link,

Designing a Custom Toolbar in Xamarin Pdf Viewer | Syncfusion

Live Chat Icon For mobile
Up arrow icon