0

I'm suffering with an annoying issue, when I pick a file using xamarin crossmedia plugin, my app freezes and crashs after some minutes.

My code:

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);
            }
        }
}

It should pass type of Message(6) and the path to another page that binds it to an Image source. I tried with different images(tiny images crashs too), also have tried taking PickMediaOptions, just PickPhotoAsync() with no success. The strange is it worked some times today and suddenly has stopped. Also I'm using this same plugin and code on other page and it works properly.

No exceptions are threw, the last lines of app output are these:

[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

Does anyone have tips of what can I do?

Éder Rocha
  • 1,538
  • 11
  • 29
  • What is the exception causing the crash? Which line causes the exception? What does the stack trace show? – Jason Apr 29 '20 at 03:30
  • @Jason no exceptions... the last lines showed on vs are these. – Éder Rocha Apr 29 '20 at 11:49
  • @Jason I just realized that this problem occurs when the file is binding to the image view. I'm doing it as string, ``````, if I comment the line that binds the image, everything works. – Éder Rocha Apr 29 '20 at 12:57
  • what are you setting `imagem` to? – Jason Apr 29 '20 at 13:00
  • @Jason imagem is the path file. I just tried by attributing path to Image source: ```ImageName.Source = imagem;``` and it worked. The problem is I need to add this as an item of a observable collection and then it is binded on xaml. When xaml receives the new value(it goes also as string) it freezes and crash the app. – Éder Rocha Apr 29 '20 at 13:02
  • I'd suggest adding a crash tool like appcenter.ms to see if that can catch the underlying exception – Jason Apr 29 '20 at 13:11
  • @Jason the worst thing is that I have appcenter but there is nothing related to this issue. – Éder Rocha Apr 29 '20 at 13:22
  • @Jason the problem is with any image, even the ones that are in drawable – Éder Rocha Apr 29 '20 at 13:36
  • @ÉderRochaBezerra I suggest you can provide one simple sample that can reproduce your problem at github, I will help you to test it at my side. – Cherry Bu - MSFT Apr 30 '20 at 08:24
  • 1
    @CherryBu-MSFT thank you so much but I found the problem, it was related to memory allocation. – Éder Rocha Apr 30 '20 at 16:06
  • @ÉderRochaBezerra Please share your solution by posting one reply, and marking your reply as answer, it is beneficial to others to find your answer, thanks. – Cherry Bu - MSFT May 06 '20 at 07:07

0 Answers0