Mackenzie Martyn
Mackenzie Martyn

Reputation: 45

NativeScript markingMode: none errors

I'm part of a team that's using NativeScript and angular and we keep getting errors that look like:

Error: com.tns.NativeScriptException: Attempt to use cleared object reference id=<some-object-id-number>

From some research it's because we use markingMode: none in order to speed up our application. We want to keep using this so we need to find the source of the errors. From the documentation, it comes from creating a native object then wrapping it in a JS method so the garbage collector removes the native object in the method but since it's still being referenced an error is thrown. The documentation also indicated that this most likely stems from using plugins that haven't adapted to markingMode: none. The plugin I believe that's causing this is the nstudio nativescript-checkbox plugin. So I looked through the source code to try to find the native options that fit the criteria and my issues are the following:

  1. I'm not sure if I'm finding all the native objects.
  2. I don't know where to release them in the code.
  3. I'm not sure if this plugin is the only one that's causing issues (we use a lot of plugins and all of them are pretty integral to our code).
  4. I scoured our code base and couldn't find any instances where this may be a problem, but I could be wrong.

If anyone has experienced this markingMode: none issue, specifically with plugins, I would love to hear how you dealt with it and if you had any tips/suggestions moving forward. Here's the documentation detailing this issue: https://docs.nativescript.org/core-concepts/android-runtime/advanced-topics/marking-mode-none

The NativeScript developers said it was fixed in this bug fix with an update, but I haven't noticed a change: https://github.com/NativeScript/NativeScript/issues/7125

UPDATE: I commented out the checkbox plugin and no error, this is definitely being caused by the plugin

Upvotes: 1

Views: 397

Answers (1)

Mackenzie Martyn
Mackenzie Martyn

Reputation: 45

Removed all instances of the checkbox component and the side navigation bar and made our own custom components for them.

Upvotes: 0

Related Questions