Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
neowinston
Visitor

roRegistrySection writing crash

I'm using roRegistrySection to save and later retried a string, but the app is crashing when trying to write or read the data. Here is the code and below is the error log:

Writing:


BRIGHTSCRIPT: ERROR: roRegistrySection: no plugin instance available: pkg:/components/screens/DetailsScreen/DetailsScreen.brs(122)


Function SetAuthData(userToken As String) As Void
    sec = CreateObject("roRegistrySection", "Authentication")
    sec.Write("UserRegistrationToken", userToken)
    sec.Flush()
End Function


Reading:


Function SetAuthData(userToken As String) As Void
    sec = CreateObject("roRegistrySection", "Authentication")
    sec.Write("UserRegistrationToken", userToken)
    sec.Flush()
End Function



Error log:

Current Function:
118:  Function SetAuthData(userToken As String) As Void
119:      sec = CreateObject("roRegistrySection", "Authentication")
120:*     sec.Write("UserRegistrationToken", userToken)
121:      sec.Flush()
122:  End Function
'Dot' Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in pkg:/components/screens/DetailsScreen/DetailsScreen.brs(120)
120:     sec.Write("UserRegistrationToken", userToken)
Backtrace:
#1  Function setauthdata(usertoken As String) As Void
   file/line: pkg:/components/screens/DetailsScreen/DetailsScreen.brs(120)
#0  Function onitemselected() As Void
   file/line: pkg:/components/screens/DetailsScreen/DetailsScreen.brs(100)
Local Variables:
usertoken        roString (2.1 was String) refcnt=1 val:"English"
global           Interface:ifGlobal
m                roAssociativeArray refcnt=3 count:6
sec              Invalid
Threads:
ID    Location                                Source Code
 0    pkg:/source/main.brs(21)                msg = wait(0, port)
 1*   ...ailsScreen/DetailsScreen.brs(120)    sec.Write("UserRegistrationToken", userToken)
  *selected


What is happening? Please help. Thank you!
Tags (1)
0 Kudos
2 REPLIES 2
renojim
Community Streaming Expert

Re: roRegistrySection writing crash

What's happening is that CreateObject("roRegistrySection", "Authentication") is returning invalid.  If I had to guess, I'd say you're trying to call it in some node that is not a Task node.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
Tags (1)
0 Kudos
neowinston
Visitor

Re: roRegistrySection writing crash

I changed it to a Task node and now it's working! Thanks for your help!
Tags (1)
0 Kudos
Community is Temporarily in Read-Only Mode!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!