The cause of the issue is that the Document folders in the project have gotten messed-up, with multiple folders being listed as a 'root-folder' which is not allowed. So if you receive this error on the Test Case Details page:
Unable to cast object of type 'System.DBNull' to type 'System.String'.
Then the first thing to do is to run:
SELECT * FROM TST_PROJECT_ATTACHMENT_FOLDER WHERE PROJECT_ID = X
(where X is the ID of the project).
If you see multiple entries in the results with PARENT_PROJECT_ATTACHMENT_FOLDER_ID set to NULL then that is the cause of the issue. In which case, you need to set the PARENT_PROJECT_ATTACHMENT_FOLDER_ID for the second result to the real root project ID.
For example, if you have the following:
PROJECT_ATTACHMENT_FOLDER_ID | PROJECT_ID | PARENT_PROJECT_ATTACHMENT_FOLDER_ID | NAME |
1 | 1 | NULL | Root Folder |
2 | 1 | 1 | Specifications |
3 | 1 | 1 | Screen Captures |
4 | 1 | 1 | Test Results |
5 | 1 | 4 | Error Messages |
6 | 1 | 4 | Web Links |
7 | 1 | 1 | Design Documents |
8 | 1 | 1 | Misc Documents |
12 | 1 | 1 | Test Scripts |
14 | 1 | 1 | CreateNewAuthor |
15 | 1 | NULL | CreateNewBook |
16 | 1 | 1 | EditExistingAuthor |
17 | 1 | 1 | EditExistingBook |
Then you'd run the following:
UPDATE TST_PROJECT_ATTACHMENT_FOLDER
SET PARENT_PROJECT_ATTACHMENT_FOLDER_ID = 1
WHERE PROJECT_ATTACHMENT_FOLDER_ID = 15
and that would fix the issue.
If you are hosted by Inflectra, then just mention this article in the ticket along with the error message and the ID of the affected project, and a member of our support team will fix it for you.