Scene Graph applications can be debugged using the same tools as previous Roku applications. However, there are some additional ports that can be used to debug specific threads of Scene Graph applications, and port 8085 has limited value in debugging Scene Graph applications.
Because Scene Graph applications run on their own thread, and can also launch additional asynchronous threads using a Task node, five additional ports are available for debugging, as follows.
|8085||Main()||The starting point of all Roku applications. For Scene Graph applications, the Main() function only starts the Scene Graph application thread, so provides no debugging information about the Scene Graph application itself.|
|8089||Scene Graph||The main Scene Graph application thread. This contains all of the debugging information for Scene Graph applications, except for information returned from asynchronous threads launched by a Task node.|
|8090||first Task node thread||The first asynchronous thread launched by a Task node. If only one asynchronous thread is running after the Task node thread is launched, this port will show the debugging information for that thread.|
|8091||second Task node thread||The second asynchronous thread launched by a Task node. If there are two asynchronous threads running after a Task node is launched, this port will show the debugging information for the second thread launched.|
third Task node thread
|The third asynchronous thread launched by a Task node. If there are three asynchronous threads running after a Task node is launched, this port will show the debugging information for the third thread launched.|
|8093||more than three Task node threads||This port is used if there are more than three asynchronous threads that have been launched by a Task node. If there are more than three asynchronous threads running after a Task node is launched, this port will show all the debugging information for all the threads launched after the third asynchronous thread.|
Troubleshooting Common Development Errors
There are several very common errors that you will encounter when developing Scene Graph applications. Quite often these errors are caused by not spelling component names or variables correctly, but may appear as different types of errors on the display screen and in the debugger.
Graphic Image Does Not Appear, Question Mark Appears Instead of Image
The graphic image file was not found in the location specified in the application. Check that graphic image file is in the specified location, either on your development server, or in the application ZIP package, usually in the
pkg:/images directory. Make sure the path to the file is correct, and the name of the file is spelled correctly. Roku Scene Graph applications, like previous Roku applications, generally follow the convention used in many client display applications, such as web browsers, which is to show a default image if the specified image cannot be found. If a question mark image is shown in a Roku Scene Graph application, check the path and file name spelling to ensure that the correct graphic image appears.
Debugger Message: Type Mismatch
This usually means that a BrightScript variable has been incorrectly spelled after it has been declared, never declared at all, or declared as a local variable in another function. Check the backtrace information supplied by the debugger for the local variables used at the time of the error, and note that the variables listed as
<uninitialized>. Check for the declaration of the variable or variables listed earlier in the application prior to the error message, and correct the spelling, or declare them correctly, as needed. In many cases, the error occurs because there is an attempt to use a local variable declared in one function block in another function. To correct this, you can declare the variable using the
m object reference which gives the variable file scope.
Debugger Message: 'Dot' Operator attempted with invalid BrightScript Component or interface reference.
This message will often coincide with a blank screen. The line number at which the error is detected will be flagged with an asterisk, and the message will provide the name of the file in which the error was detected:
020:* smallexamplesize = smallexample.localBoundingRect()
'Dot' Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in ...pkg:/components/smallexamplescene.xml(20)
020: smallexamplesize = smallexample.localBoundingRect()
This message will appear if a component by that name has either not been created, or an attempt is made to access a component member using an incorrectly spelled component name. Check the backtrace information supplied by the debugger for the component objects and variables used at the time of the error, and note the component objects listed as
#0 Function init() As Void
m roAssociativeArray refcnt=3 count:2
devinfo bsc:roDeviceInfo refcnt=1
screenresolution roAssociativeArray refcnt=1 count:3
Note also the variables that were assigned values from interface functions on invalid component objects will be listed as
<uninitialized>. Typically in Roku Scene Graph applications, the problem is caused by attempting to create a component object for a component class name that is not in either the built-in node classes, or extended node classes declared in the application package
components directory. To fix this error, scroll up in the debugger output to the point at which the component object creation error occurred, which will have the following error message:
BRIGHTSCRIPT: ERROR: roSGNode: Failed to create roSGNode with type Rectangleexample: ...pkg:/components/smallexamplescene.xml(16)
This shows the file and line number where the actual component object creation error occurred. To fix the error, correct the mismatch between the component name and the component object creation function argument. Quite often this is the result of a case mismatch between the extended component name in a
<component> element, since these names are case-sensitive. Correct the case-sensitive spelling of the component name either in the component file, or at the point where you attempted to create the component object.