Put app in background then resume and this error can occur at anytime. Likely related to an *ngIf on a root component view which is attempting to retrigger change detection on app re-activation. The fix is very likely quite simple in the need to simply guard a fragile area of core modules which is doing this check.
Which platform(s) does your issue occur on?
Both
Please provide the following version numbers that your issue occurs with:
- CLI: 4.2.0
- Cross-platform modules: 4.2.0
- Runtime(s): 4.2.0
Please tell us how to recreate the issue in as much detail as possible.
I will explore a way to create an exact repro of this issue however this is a race condition and not known to happen everytime and therefore will be dificult to repro 100%. Simple guard check around if (view) view.isLoaded will likely be all that's needed to fix this issue instead of simply assuming view would be defined at the expected moment in time.
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
In a root app.component you could have something like the following:
<GridLayout>
<page-router-outlet></page-router-outlet>
<some-custom-component *ngIf="someCondition"></some-custom-component>
</GridLayout>
Here's the stack that can occur:
CONSOLE LOG file:///app/bundle.js:6882:24: suspendEvent
CONSOLE LOG file:///app/bundle.js:6882:24: resumeEvent
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x109b4cc1f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool, bool)
2 0x109b768ea NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
3 0x10a543ced ffi_closure_unix64_inner
4 0x10a544642 ffi_closure_unix64
5 0x10f225a65 _CFXRegistrationPost
6 0x10f2257a1 ___CFXNotificationPost_block_invoke
7 0x10f1e7422 -[_CFXNotificationRegistrar find:object:observer:enumerator:]
8 0x10f1e65a1 _CFXNotificationPost
9 0x10ac20e57 -[NSNotificationCenter postNotificationName:object:userInfo:]
10 0x10b25a675 -[UIApplication _stopDeactivatingForReason:]
11 0x10bc7a89c __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke
12 0x10be754b7 _performActionsWithDelayForTransitionContext
13 0x10bc7a627 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]
14 0x10b9f70e0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:]
15 0x10b8340bd -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:]
16 0x111b6cd2d __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362
17 0x10fb75709 _dispatch_client_callout
18 0x10fb7a8c1 _dispatch_block_invoke_direct
19 0x111ba0470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
20 0x111ba012e -[FBSSerialQueue _performNext]
21 0x111ba068e -[FBSSerialQueue _performNextFromRunLoopSource]
22 0x10f22cbb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
23 0x10f2114af __CFRunLoopDoSources0
24 0x10f210a6f __CFRunLoopRun
25 0x10f21030b CFRunLoopRunSpecific
26 0x112435a73 GSEventRunModal
27 0x10b264057 UIApplicationMain
28 0x10a54449d ffi_call_unix64
29 0x127563cd0
JavaScript stack trace:
1 loadView@file:///app/vendor.js:103443:18
2 @file:///app/vendor.js:103238:27
3 eachChildView@file:///app/vendor.js:112014:34
4 eachChild@file:///app/vendor.js:104659:27
5 onLoaded@file:///app/vendor.js:103237:23
6 @file:///app/vendor.js:103316:98
7 callFunctionWithSuper@file:///app/vendor.js:103309:13
8 callLoaded@file:///app/vendor.js:103316:35
9 didBecomeActive@file:///app/vendor.js:88337:32
10 @[native code]
11 onReceive@file:///app/vendor.js:88212:32
12 UIApplicationMain@[native code]
13 start@file:///app/vendor.js:88454:26
14 run@file:///app/vendor.js:88482:10
15 bootstrapNativeScriptApp@file:///app/vendor.js:66933:26
16 bootstrapApp@file:///app/vendor.js:66867:38
17 bootstrapModuleFactory@file:///app/vendor.js:66849:26
18 ./main.aot.ts@file:///app/bundle.js:21713:123
19 __webpack_require__@file:///app/bundle.js:76:34
20 checkDeferredModules@file:///app/bundle.js:45:42
21 @file:///app/bundle.js:151:38
22 anonymous@file:///app/bundle.js:152:12
23 evaluate@[native <…>
JavaScript error:
file:///app/vendor.js:103443:18: JS ERROR TypeError: undefined is not an object (evaluating 'view.isLoaded')
Reactions are currently unavailable
Put app in background then resume and this error can occur at anytime. Likely related to an *ngIf on a root component view which is attempting to retrigger change detection on app re-activation. The fix is very likely quite simple in the need to simply guard a fragile area of core modules which is doing this check.
Which platform(s) does your issue occur on?
Both
Please provide the following version numbers that your issue occurs with:
Please tell us how to recreate the issue in as much detail as possible.
I will explore a way to create an exact repro of this issue however this is a race condition and not known to happen everytime and therefore will be dificult to repro 100%. Simple guard check around if (view) view.isLoaded will likely be all that's needed to fix this issue instead of simply assuming view would be defined at the expected moment in time.
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
In a root app.component you could have something like the following:
Here's the stack that can occur: