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
close icon

Canceling search results in Exception on Android

I am attempting to cancel the search and open my own window. The custom code passes, but then an exception is thrown in the pdf viewer.

I capture the search initiation

pdfViewerControl.SearchInitiated += PdfViewerControl_SearchInitiated;

Then call this

        private void PdfViewerControl_SearchInitiated(object sender, Syncfusion.SfPdfViewer.XForms.TextSearchInitiatedEventArgs args)

        {

            pdfViewerControl.CancelSearch();

            Navigation.PushModalAsync(new SearchPage());

        }

The break point will go past the above, then I see this:

  0xC6 in Syncfusion.SfPdfViewer.XForms.Droid.TextSearchHandler.SearchText C#

  0x29 in Syncfusion.SfPdfViewer.XForms.Droid.PdfDependencyServices.SearchText C#

  0xD in Syncfusion.SfPdfViewer.XForms.SfPdfViewer.SearchText C#

  0x5C in Syncfusion.SfPdfViewer.XForms.SearchToolbar.SearchEntry_Completed C#

  0x39 in Xamarin.Forms.SearchBar.OnSearchButtonPressed at D:\a\1\s\Xamarin.Forms.Core\SearchBar.cs:129,4 C#

  0x6 in Xamarin.Forms.Platform.Android.SearchBarRenderer.Android.Widget.SearchView.IOnQueryTextListener.OnQueryTextSubmit at D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\SearchBarRenderer.cs:48,4 C#

  0x11 in Android.Widget.SearchView.IOnQueryTextListenerInvoker.n_OnQueryTextSubmit_Ljava_lang_String_ at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-31/mcw/Android.Widget.SearchView.cs:261,5 C#

  0x9 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_Z at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:132,5 C#


1 Reply

VD Vikram Devaraj Syncfusion Team May 1, 2023 09:41 AM UTC

Hi Stephen, We were unable to replicate the reported issue and were able to cancel the search with your shared code. Could you please share your elobarted replication steps and replication video, PDF and device details to analyse further on this issue or modify the attached sample to replicate the issue. Also, could you please explain the reason for cancelling the search in the "SearchInitiated" event and creating a search page?


Attachment: Sample_409d30cd.zip

Loader.
Live Chat Icon For mobile
Up arrow icon