1

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

  • Did you try commenting the check box plugin from all your components, at least that might help you to break down the issue see if it's the only plugin causing it. – Manoj Jan 07 '20 at 02:15
  • Yes I did, I'll update with that – Mackenzie Martyn Jan 07 '20 at 23:22
  • You may have to debug further to track which lines of code are exactly causing the issue Or I would suggest mimicking the functionality of Checkbox with an image / font icon & label. – Manoj Jan 08 '20 at 07:28
  • The nature of the error is very random as garbage collection isn't consistent. I think I'll be mimicking the checkbox functionality – Mackenzie Martyn Jan 09 '20 at 15:59
  • I have the same issue. I just removed "markingMode: none" from the app as I couldn't figure out the cause – mast3rd3mon Mar 09 '20 at 09:40
  • Although, my issues are relating to routin, tabs and gridlayouts rather than a checkbox – mast3rd3mon Mar 09 '20 at 09:55
  • @mast3rd3mon that shouldn't be the case. I have tabs and grid layouts and they work fine. – Mackenzie Martyn Mar 10 '20 at 18:56
  • I was more just commenting hat I also have the issue but I dont use the checkbox component. So something else is most likely the issue – mast3rd3mon Mar 12 '20 at 08:43

1 Answers1

0

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