Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joetesta
Level 11

Overwriting vars crashing channel?

Hi all -
I could really use some help debugging this. I'm trying to modify a private channel so that the registration process happens before the home screen loads, but the channel keeps crashing without any error message on the debug console.

I've been working through it and it seems that whenever I overwrite a pre-existing variable (screen, rsp), the channel exits without an error. I don't really understand why it's doing that since the code seemed to work that way before and I'm just changing the order of things.

First it was happening because my CongratulationsScreen was using 'screen' and in the preShowHomeScreen sub it was dying at the line:
screen = CreateObject("roPosterScreen")


so i changed the showCongratulationsScreen sub to use 'cscreen' and now it's failing in LoadCategoryFeed on the line:
rsp = http.GetToStringWithRetry()

I assume it's failing because the 'rsp' variable is already defined during the registration process.

I'd like to note that the failure only happens the first time when the user has to go through the registration process. After the UID is stored, and the registration bypassed, the revised channel works as usual.

Should I be able to reuse the variables, does anyone have any ideas what's going wrong?
tyvmia
aspiring
0 Kudos
3 REPLIES 3\
RokuChris
Roku Employee
Roku Employee

Re: Overwriting vars crashing channel?

If there's nothing on the console, it's probably not crashing. Sounds like maybe you're closing the bottom screen in your stack: viewtopic.php?f=34&t=50590
0 Kudos
joetesta
Level 11

Re: Overwriting vars crashing channel?

Thanks RokuChris -
I'm pretty sure it's crashing because I have debug code like this:
Function load_category_feed(conn As Object) As Dynamic
http = NewHttp(conn.UrlCategoryFeed)
Dbg("url: ", http.Http.GetUrl())
print "made it here 04a"
m.Timer.Mark()
print "made it here 04b"
rsp = http.GetToStringWithRetry()
print "made it here 04c"


and in the debug console I see
made it here 03a
url: http://www.mysite.com/roku/categories.xml
made it here 04a
made it here 04b


With no "04c" line, while the roku is back on the home screen outside my channel.
aspiring
0 Kudos
joetesta
Level 11

Re: Overwriting vars crashing channel?

I tried following that suggestion you linked; it didn't work at first, when I didn't place it at the VERY beginning of my Main Sub, but now that I did, it looks like everything is working correctly!

Still don't understand in light of what I posted above, but hey, it's working so I'm happy now - THANK YOU Smiley Happy
aspiring
0 Kudos