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_IDPROJECT_IDPARENT_PROJECT_ATTACHMENT_FOLDER_IDNAME
11NULLRoot Folder
211Specifications
311Screen Captures
411Test Results
514Error Messages
614Web Links
711Design Documents
811Misc Documents
1211Test Scripts
1411CreateNewAuthor
151NULLCreateNewBook
1611EditExistingAuthor
1711EditExistingBook

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.