{"record":{"id":"0f0c3ded19b630ee","repo":"NativeScript/NativeScript","slug":"invalid-call-to-this-resumenativeupdates","errorCode":null,"errorMessage":"Invalid call to ${this}._resumeNativeUpdates","messagePattern":"Invalid call to (.+?)\\._resumeNativeUpdates","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/ui/core/view-base/index.ts","lineNumber":795,"sourceCode":"\t}\n\n\tpublic _setDefaultPaddings(insets: any): void {\n\t\t// Overridden\n\t}\n\n\tpublic _suspendNativeUpdates(type: SuspendType): void {\n\t\tif (type) {\n\t\t\tthis._suspendNativeUpdatesCount = this._suspendNativeUpdatesCount | type;\n\t\t} else {\n\t\t\tthis._suspendNativeUpdatesCount++;\n\t\t}\n\t}\n\tpublic _resumeNativeUpdates(type: SuspendType): void {\n\t\tif (type) {\n\t\t\tthis._suspendNativeUpdatesCount = this._suspendNativeUpdatesCount & ~type;\n\t\t} else {\n\t\t\tif ((this._suspendNativeUpdatesCount & SuspendType.IncrementalCountMask) === 0) {\n\t\t\t\tthrow new Error(`Invalid call to ${this}._resumeNativeUpdates`);\n\t\t\t}\n\t\t\tthis._suspendNativeUpdatesCount--;\n\t\t}\n\n\t\tif (!this._suspendNativeUpdatesCount) {\n\t\t\tthis.onResumeNativeUpdates();\n\t\t}\n\t}\n\n\t/**\n\t * Allow multiple updates to be performed on the instance at once.\n\t */\n\tpublic _batchUpdate<T>(callback: () => T): T {\n\t\ttry {\n\t\t\tthis._suspendNativeUpdates(SuspendType.Incremental);\n\n\t\t\treturn callback();\n\t\t} finally {","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/NativeScript/NativeScript/blob/6800aefa6511d23ddad8beb38ccc8541c5e91628/packages/core/ui/core/view-base/index.ts#L777-L813","documentation":"`_resumeNativeUpdates` with no explicit SuspendType decrements the incremental suspend counter; if the counter's IncrementalCountMask is already 0 there is nothing to resume, indicating unbalanced suspend/resume calls, so it throws. Every `_suspendNativeUpdates` call must be matched by exactly one resume.","triggerScenarios":"Calling `view._resumeNativeUpdates()` more times than `_suspendNativeUpdates()` was called; calling resume without a type argument after zero suspends; nested layout batches where an exception skipped the paired resume call.","commonSituations":"Custom components manually batching native updates with suspend/resume and losing count across early returns/exceptions; framework-level layout batching misuse in plugins.","solutions":["Balance every `_suspendNativeUpdates()` call with exactly one `_resumeNativeUpdates()` call (use try/finally)","Pass the matching SuspendType used when suspending instead of calling the no-arg incremental form","Audit plugin/custom code for unpaired suspend/resume calls","Use higher-level batch APIs (e.g. `eachChild`-aware batching) instead of manual counting"],"exampleFix":"// before\nview._suspendNativeUpdates();\nupdateChildren(); // throws early, resume never runs\nview._resumeNativeUpdates();\n// after\nview._suspendNativeUpdates();\ntry {\n  updateChildren();\n} finally {\n  view._resumeNativeUpdates();\n}","handlingStrategy":"try-catch","validationCode":"// pair check before resuming:\nif ((view as any)._suspendNativeUpdatesCount & SuspendType.IncrementalCountMask) {\n  view._resumeNativeUpdates();\n}","typeGuard":"function canResumeIncremental(view: ViewBase): boolean {\n  return ((view as any)._suspendNativeUpdatesCount & SuspendType.IncrementalCountMask) > 0;\n}","tryCatchPattern":"try { view._resumeNativeUpdates(); } catch (e) { if (!String(e.message).includes('_resumeNativeUpdates')) throw e; /* unbalanced call: log and correct batching logic */ }","preventionTips":["Always wrap _suspendNativeUpdates/_resumeNativeUpdates pairs in try/finally","Pass the same SuspendType to resume that was used to suspend","Prefer framework batching helpers over manual suspend counting in custom components"],"tags":["native-updates","layout","suspend-resume","internal-api"],"backgroundTag":"unbalanced-suspend-resume-calls","analyzedSha":"6800aefa6511d23ddad8beb38ccc8541c5e91628","analyzedAt":"2026-08-30T20:04:56.809Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}