Выбор изображения из галереи с плагином Xamarin CrossMedia вызывает завершение приложения - PullRequest
0 голосов
/ 29 апреля 2020

Я страдаю от досадной проблемы: когда я выбираю файл с помощью плагина xamarin crossmedia, мое приложение зависает и вылетает через несколько минут.

Мой код:

async void ImageButton_Clicked(System.Object sender, System.EventArgs e)
{
       if (!await StoragePermission())
       {
          ShowAlert("You need grant permission");
            return;
       }
       else
       {
           try
           {
              var a = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions {  CompressionQuality = 60, RotateImage = true });
              await Navigation.PopPopupAsync();
              MessagingCenter.Send<PassaParametro>(new PassaParametro { Tipo = 6, Valor = a.Path }, "PopUpData");
            }
            catch (Exception error)
            {
                ShowAlert("error", "Ocorreu um erro", error.Message);
            }
        }
}

Он должен передавать тип сообщения (6) и путь к другой странице, которая связывает его с источником изображения. Я пробовал с разными изображениями (крошечные изображения тоже вылетали), также пытался использовать PickMediaOptions, просто PickPhotoAsyn c (), но безуспешно. Странно, что сегодня он работал несколько раз и внезапно остановился. Также я использую этот же плагин и код на другой странице, и он работает правильно.

Нет исключений, последние строки приложения выводятся так:

[InputMethodManager] Starting input: tba=android.view.inputmethod.EditorInfo@5b7b571 nm : com.Beta ic=null
[InputMethodManager] [IMM] startInputInner - mService.startInputOrWindowGainedFocus
[InputTransport] Input channel constructed: fd=107
[InputTransport] Input channel destroyed: fd=83
[ExifInterface_JNI] Raw image not detected
[ExifInterface] Skip the tag entry since tag number is not defined: 34864
[ExifInterface] Skip the tag entry since tag number is not defined: 34866
[ExifInterface] Skip the tag entry since tag number is not defined: 2
[ExifInterface] Skip the tag entry since tag number is not defined: 42032
[ExifInterface] Skip the tag entry since tag number is not defined: 42033
[ExifInterface] Skip the tag entry since tag number is not defined: 42034
[ExifInterface] Skip the tag entry since tag number is not defined: 42036
[ExifInterface] Skip the tag entry since tag number is not defined: 42037
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_set_boolean_field'.
[Mono] Probing 'java_interop_jnienv_set_boolean_field'.
[Mono] Found as 'java_interop_jnienv_set_boolean_field'.
[ViewRootImpl@b14c929[MainActivity]] MSG_RESIZED: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
[ViewRootImpl@24e3258[MediaPickerActivity]] MSG_WINDOW_FOCUS_CHANGED 0
[ViewRootImpl@24e3258[MediaPickerActivity]] mHardwareRenderer.destroy()#1
[ViewRootImpl@24e3258[MediaPickerActivity]] Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true
[AbsListView] viewType is heaer or footer
[AbsListView] viewType is heaer or footer
[art] Do partial code cache collection, code=54KB, data=60KB
[art] After code cache collection, code=54KB, data=60KB
[art] Increasing code cache capacity to 256KB
[ViewRootImpl@24e3258[MediaPickerActivity]] mHardwareRenderer.destroy()#4
[ViewRootImpl@24e3258[MediaPickerActivity]] dispatchDetachedFromWindow
[InputTransport] Input channel destroyed: fd=89
[art] Starting a blocking GC Explicit
[art] Explicit concurrent mark sweep GC freed 1306(44KB) AllocSpace objects, 1(20KB) LOS objects, 7% free, 195MB/211MB, paused 334us total 22.938ms
[Mono] GC_TAR_BRIDGE bridges 257 objects 274 opaque 4 colors 257 colors-bridged 257 colors-visible 257 xref 1 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.06ms tarjan 0.09ms scc-setup 0.05ms gather-xref 0.00ms xref-setup 0.02ms cleanup 0.08ms
[Mono] GC_BRIDGE: Complete, was running for 25.36ms
[Mono] GC_MINOR: (Nursery full) time 7.21ms, stw 7.96ms promoted 975K major size: 6640K in use: 5843K los size: 9216K in use: 7652K
[art] Starting a blocking GC Explicit
[art] Explicit concurrent mark sweep GC freed 1743(90KB) AllocSpace objects, 3(69MB) LOS objects, 11% free, 126MB/142MB, paused 316us total 35.238ms
[Mono] GC_TAR_BRIDGE bridges 389 objects 426 opaque 8 colors 389 colors-bridged 389 colors-visible 389 xref 2 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.06ms tarjan 0.16ms scc-setup 0.19ms gather-xref 0.01ms xref-setup 0.00ms cleanup 0.10ms
[Mono] GC_BRIDGE: Complete, was running for 38.87ms
[Mono] GC_MAJOR: (user request) time 15.21ms, stw 16.04ms los size: 8192K in use: 1022K
[Mono] GC_MAJOR_SWEEP: major size: 6512K in use: 4744K
[Mono] Loading reference 7 of /storage/emulated/0/Android/data/com.Beta/files/.__override__/Rg.Plugins.Popup.dll asmctx DEFAULT, looking for System.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
[Mono] Unloading image System.Linq.dll [0x7033a2c000].
[Mono] Image addref System.Linq[0x7033af8700] (asmctx DEFAULT) -> System.Linq.dll[0x705ae4f000]: 5
[Mono] Config attempting to parse: 'System.Linq.dll.config'.
[Mono] Config attempting to parse: '/Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/sdks/out/android-arm64-v8a-release/etc/mono/assemblies/System.Linq/System.Linq.config'.
[Mono] Assembly Ref addref Rg.Plugins.Popup[0x70743c9300] -> System.Linq[0x703c79a200]: 3
[InputMethodManager] HSI from window - flag : 0 Pid : 21488
[Mono] DllImport searching in: 'libmono-btls-shared' ('./libmono-btls-shared.so').
[Mono] Searching for 'mono_btls_ssl_close'.
[Mono] Probing 'mono_btls_ssl_close'.
[Mono] Found as 'mono_btls_ssl_close'.
[Mono] DllImport searching in: 'libmono-btls-shared' ('./libmono-btls-shared.so').
[Mono] Searching for 'mono_btls_ssl_destroy'.
[Mono] Probing 'mono_btls_ssl_destroy'.
[Mono] Found as 'mono_btls_ssl_destroy'.
[Mono] DllImport searching in: 'libmono-btls-shared' ('./libmono-btls-shared.so').
[Mono] Searching for 'mono_btls_x509_store_free'.
[Mono] Probing 'mono_btls_x509_store_free'.
[Mono] Found as 'mono_btls_x509_store_free'.
[Mono] DllImport searching in: 'libmono-btls-shared' ('./libmono-btls-shared.so').
[Mono] Searching for 'mono_btls_ssl_ctx_free'.
[Mono] Probing 'mono_btls_ssl_ctx_free'.
[Mono] Found as 'mono_btls_ssl_ctx_free'.
[libc] Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7fd2145cf0 in tid 21488

У кого-нибудь есть советы, что я могу сделать?

...