Diagnostics

The DIAGNOSTICS panel lists every problem the compiler reports in the project: errors, warnings, hints and information messages. The panel is docked at the bottom of the default layout. View → DIAGNOSTICS shows it.

The Diagnostics pane with no project open. Four counts, each 0, sit at the right of its title bar: Errors, Warnings, Hints and Information. A label at the left of the pane names each one, with an arrow that curves up to its count from below.The Diagnostics pane with no project open. Four counts, each 0, sit at the right of its title bar: Errors, Warnings, Hints and Information. A label at the left of the pane names each one, with an arrow that curves up to its count from below.

The four kinds

Kind Colour
Error Red
Warning Yellow
Information Blue
Hint Green

At the right of the title bar, four counters show how many problems of each kind the project has. The counters always count everything, whatever is shown in the list below.

Each counter is also a switch. Click it to show or hide the problems of that kind. Errors and warnings are shown at first. Hints and information are hidden. The pointer tooltip of a counter reads, for example, Total Error Count -> click to toggle on/off. The IDE keeps the four switches for each project, and brings them back when you reopen it.

The title bar of the Diagnostics pane with two errors, no warnings, no hints and three information messages, each count in a red box. A label reading Click to toggle ON/OFF sits below the bar, with an arrow rising from it to each of the four counts.The title bar of the Diagnostics pane with two errors, no warnings, no hints and three information messages, each count in a red box. A label reading Click to toggle ON/OFF sits below the bar, with an arrow rising from it to each of the four counts.

The commands tbProblems_ToggleShowErrors, tbProblems_ToggleShowWarnings, tbProblems_ToggleShowHints and tbProblems_ToggleShowInfos flip the same switches. They have no keys by default.

The list

The list has one group for each file that has a problem to show. The group’s header is the file’s name, and pointing at it shows the path. Click the arrow at the left of the header, or double-click the header, to collapse or expand the group.

Under a header, each row is one problem. A row shows an icon for its kind, the code and the message, and the position in square brackets as [line,column]. The code is TB and four digits, such as TB0012. When the compiler gives no code, the row shows TB5000. Pointing at a row shows its message in full.

The DIAGNOSTICS panel with its counts of 1 error, 4 warnings, 1 hint and 1 information message, and with Hints and Information switched on. The rows are grouped under three files, Helpers.twin, Inventory.twin and MainModule.twin. Each row shows its icon, its code such as TB0012 or TB5079, its message and its position. The error’s row, TB5079 Unrecognized symbol 'Undefined1', is selected, with Jump to issue and Help under it.The DIAGNOSTICS panel with its counts of 1 error, 4 warnings, 1 hint and 1 information message, and with Hints and Information switched on. The rows are grouped under three files, Helpers.twin, Inventory.twin and MainModule.twin. Each row shows its icon, its code such as TB0012 or TB5079, its message and its position. The error’s row, TB5079 Unrecognized symbol 'Undefined1', is selected, with Jump to issue and Help under it.

Go to a problem

Click a row to select it. Two buttons appear under the row:

Jump to issue
Opens the file at the line and column of the problem, and puts the focus in the code.
Help
Shows only the message Online help content coming soon.

A double-click on a row does the same as Jump to issue.

Copy problems

Right-click in the list for a menu of five items. The menu is in English whatever the IDE language is.

Copy
Copies the row under the pointer.
Copy All
Copies the rows that are shown. A kind that is switched off is not copied.
Copy All Errors
Copies the errors only.
Collapse all, Expand all
Collapse or expand every group.
The right-click menu of the DIAGNOSTICS panel, open over the error’s row, with Copy, Copy All and Copy All Errors above a separator and Collapse all and Expand all below it.The right-click menu of the DIAGNOSTICS panel, open over the error’s row, with Copy, Copy All and Copy All Errors above a separator and Collapse all and Expand all below it.

A copied row reads {ERROR} or {WARNING}, the path of the file, the position, and the code and message. Copy All and Copy All Errors begin with a line that names the IDE: twinBASIC ( and the version, then ) compilation error report:.

Note BETA 1042

Each copied message contains the HTML tag <span>TBnnnn</span> around the code, and Copy All labels hints and information messages {WARNING}. Remove the tags from the pasted text by hand.

In the code

A problem also shows in other places:

  • The editor underlines the part of the code the problem refers to with a wavy line. Hover over it to see the message, as TBnnnn: and the text.

    A ClassId attribute with empty parentheses in the editor, with a red wavy underline under ClassId and, above the line, the editor’s text: insert a randomly generated GUID.A ClassId attribute with empty parentheses in the editor, with a red wavy underline under ClassId and, above the line, the editor’s text: insert a randomly generated GUID.
  • The tab of the file is tinted, and so is its row in the Project Explorer. The tint follows the worst problem in the file.

  • Alt+F8 and Shift+Alt+F8 move through the problems of the current file; see Navigating.

Common errors

Most errors are explained on the page of the statement, type or feature they concern, and a search for the code finds that page. These four come from code of every kind. Each is shown with the message it gives for an example.

TB5079, Unrecognized symbol ‘Undefined1’
Nothing the code can reach declares the name. It is misspelt, it is a variable that was never declared while Option Explicit is on, it is Private to another module, or it belongs to a package or library that the project does not reference. For a project imported from VB6, see Why do I see a lot of errors saying my variables are unrecognized?. For a type name, as in Dim t As NoSuchType, the message is Unrecognized datatype symbol ‘NoSuchType’.
TB5001, cannot coerce datatype LongLong to Long. Explicitly call CLng() if necessary.
A value has a type that twinBASIC does not convert to the type needed unless the code says so, such as a LongLong assigned to a Long. For an argument the message is Validation of call to ‘TakesLong’ failed. Argument for ‘n’: cannot coerce type ‘LongLong’ to ‘Long’, which in a 64-bit build is also what a LongPtr passed for a Long parameter gives. Write the conversion out with CLng or another conversion function; see the conversions of LongLong and LongPtr.
TB5027, Unrecognized member ‘NoSuchMember’ on type ‘_Collection’ [non-extensible object]
The name after a dot is not a member of the type or module before it, or is a member that is Private to it. For a module the message is [Other] does not contain ‘Hidden’, or it is inaccessible in this context.
TB5182, Syntax error. No handler for this symbol
A statement or an attribute where the language does not allow it. A line at the top level of a .twin file, outside a Module or Class block, is one case. An attribute written where it does not apply is another.

Note BETA 1042

For a type name, TB5079 reads Unrecognized symbol ‘Unrecognized datatype symbol ‘NoSuchType’’: the message for a type is put inside the message for a name.

See Also