destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2012
12:50 AM
Anyone seen a save registry value fail?
I have received a few bug reports of this happening, but I'm unable to reproduce it on any of my roku's.
It saves and loads the value just fine on all my roku's (Roku1 and Roku2 types), however, our clients are saying occasionally it pops the error message 'sometimes' when the code section is executed, meaning either it fails when writing the registry value 'sometimes' or the value is getting deleted sometimes. The channel isn't being removed from their roku, it's simply losing the value of the section/key? Have you seen this issue before?
There is no RegDelete command in the script files, just the RegDelete function itself (in case we need it for testing), and with the code above it should never be possible for .GetDisplayType() to return an invalid value to write.
Sub Main()
'... create facade, sets theme, etc etc
TheValue=RegRead("KeyName","MyChannel") 'read saved registry value
If Type(TheValue)="Invalid" Then
port=CreateObject("roMessagePort")
dialog=CreateObject("roMessageDialog")
dialog.SetMessagePort(port)
dialog.SetTitle("Invalid Registry Data")
dialog.SetText("No registry data exists - select OK to save new value")
dialog.AddButton(0,"OK")
dialog.Show()
While TRUE
dlgMsg=Wait(0,port)
If Type(dlgMsg)="roMessageDialogEvent"
If dlgMsg.isButtonPressed()
Print"Button pressed: ";dlgMsg.GetIndex();" ";dlgMsg.GetData()
Exit While
End If
End If
End While
TheValue=CreateObject("roDeviceInfo").GetDisplayType()
RegWrite("KeyName",TheValue,"MyChannel")
End If
'... displays regular screen, loads xml, etc etc etc
End Sub
Function RegRead(key,section=invalid)
If section=invalid section="Default"
sec=CreateObject("roRegistrySection",section)
If sec.Exists(key) Return sec.Read(key)
Return invalid
End Function
Function RegWrite(key,val,section=invalid)
If section=invalid section="Default"
sec=CreateObject("roRegistrySection",section)
sec.Write(key,val)
sec.Flush() 'commit it
End Function
It saves and loads the value just fine on all my roku's (Roku1 and Roku2 types), however, our clients are saying occasionally it pops the error message 'sometimes' when the code section is executed, meaning either it fails when writing the registry value 'sometimes' or the value is getting deleted sometimes. The channel isn't being removed from their roku, it's simply losing the value of the section/key? Have you seen this issue before?
There is no RegDelete command in the script files, just the RegDelete function itself (in case we need it for testing), and with the code above it should never be possible for .GetDisplayType() to return an invalid value to write.
4 REPLIES 4

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2012
06:48 AM
Re: Anyone seen a save registry value fail?
There is a 16k limit to what you can store in the registry. Is it possible that you're exceeding that? If you're signing all of your channels with the same key, that 16k is shared across every channel that uses that key.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2012
09:32 AM
Re: Anyone seen a save registry value fail?
Thanks again TheEndless. Can I suggest that the Flush() command for the registry writing return some kind of optional message on failure? For now I have to write, then flush, then give it some time, and then try to read back the value that was supposed to be written to check if it exists or not.

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2012
09:42 AM
Re: Anyone seen a save registry value fail?
Flush() returns a boolean indicating success.
--Mark
--Mark
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2012
11:55 AM
Re: Anyone seen a save registry value fail?
Thanks RokuMark! doh...yeah the component reference says that... sorry.