Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] LocalizationResourceManager.Current.CurrentCulture crashes app #1840

Open
jtorvald opened this issue Apr 4, 2022 · 7 comments
Open
Labels
bug Something isn't working. Breaky break.

Comments

@jtorvald
Copy link

jtorvald commented Apr 4, 2022

Description

When using XCT with LocalizationResourceManager I get weird crashes when I set a new culture on language switch in the settings page:
LocalizationResourceManager.Current.CurrentCulture = cult;

When I restart the app, the same line is used on App startup and then I see the correct language. This worked before.

All the latest libraries and iOS version. Will test later on Android and with a test project.

Stacktrace

In App center I see this, not sure if it's related:


0x0000000102c74000 + 62754000
SIGABRT: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]

Last Exception Backtrace

    CoreFoundation
    __exceptionPreprocess
    libobjc.A.dylib
    objc_exception_throw
    CoreFoundation
    _CFThrowFormattedException
    CoreFoundation
    -[__NSPlaceholderArray initWithObjects:count:]
    CoreFoundation
    -[__NSPlaceholderArray initWithObjects:count:]
    CoreFoundation
    +[NSArray arrayWithObjects:count:]
    MyApp.iOS
    0x0000000102c74000 + 62754000
    MyApp.iOS
    0x0000000102c74000 + 51190856
    MyApp.iOS
    0x0000000102c74000 + 51184416
    MyApp.iOS
    0x0000000102c74000 + 51184124
    MyApp.iOS
    0x0000000102c74000 + 51182116
    MyApp.iOS
    0x0000000102c74000 + 55589680
    MyApp.iOS
    0x0000000102c74000 + 77179188
    MyApp.iOS
    0x0000000102c74000 + 77160952
    MyApp.iOS
    0x0000000102c74000 + 77178864
    MyApp.iOS
    0x0000000102c74000 + 71633152
    UIKitCore
    -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:]
    MyApp.iOS
    0x0000000102c74000 + 62680232
    MyApp.iOS
    0x0000000102c74000 + 55144896
    MyApp.iOS
    0x0000000102c74000 + 2052236
    MyApp.iOS
    0x0000000102c74000 + 11417056
    MyApp.iOS
    0x0000000102c74000 + 123453168
    MyApp.iOS
    0x0000000102c74000 + 124216992
    MyApp.iOS
    0x0000000102c74000 + 124242344
    MyApp.iOS
    0x0000000102c74000 + 123314908
    MyApp.iOS
    0x0000000102c74000 + 125316604
    MyApp.iOS
    0x0000000102c74000 + 2047696


@jtorvald jtorvald added the bug Something isn't working. Breaky break. label Apr 4, 2022
@jtorvald
Copy link
Author

jtorvald commented Apr 4, 2022

A bit more info: after the crash I directly see this in de device output:

2022-04-04 21:19:09.077973+0200 MyApp.iOS[34052:341665] Xamarin.iOS: Unable to locate assembly 'MyApp.resources' (culture: 'es-ES')
2022-04-04 21:19:09.090994+0200 MyApp.iOS[34052:341665] dynamic_cast error 2: One or more of the following type_info's has hidden visibility or is defined in more than one translation unit. They should all have public visibility. N10__cxxabiv116__shim_type_infoE, id, N10__cxxabiv117__pbase_type_infoE.

This was posted 2 days ago by someone else about something iOS native, so maybe it has to do with some iOS change in recent version?
https://developer.apple.com/forums/thread/703309

@pictos
Copy link
Contributor

pictos commented Apr 4, 2022

@jtorvald,
Could you attach a small repro?

@jtorvald
Copy link
Author

jtorvald commented Apr 4, 2022

@pictos I'm trying to reproduce in a separate repo, but guess what: it works there. I will dig a bit deeper this week to see if I can find the cause.

@pictos
Copy link
Contributor

pictos commented Apr 4, 2022

Thank you @jtorvald

@jtorvald
Copy link
Author

jtorvald commented Apr 5, 2022

@pictos After hours of debugging to see what changed I came to the point where the crash happens because of a TabView being used in an active page in shell (not the current page but still in the background). Not sure how relevant but that tabview is used within a StateView.

In the sample project I use now the culture change works, but that is probably because it happens on the same page. So I would need to create a separate settings screen there in the same way to see if I can reproduce the error then. No time for that at this moment so... to be continued.

@pictos
Copy link
Contributor

pictos commented Apr 5, 2022

@jtorvald no problem, take your time. I can there's a lot of elements in the equation, having a repro will help a lot, thanks for moving this forward

@the-gozo
Copy link

@jtorvald Have you been able to solve this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working. Breaky break.
Projects
None yet
Development

No branches or pull requests

3 participants