DocumentHelper.GetDocuments() query returns null for one developer but not for another

Cory Kratz asked on August 30, 2022 19:16

We have 3 developers working on a kentico project for one of our clients and we have 2 developers who are able to get the project up and running successfully without any issues, however we have one developer, who has the same database, the same version of visual studio and DLL packages, but when we run any query with DocumentHelper.GetDocuments() - the query always returns null.

Here's a sample query:

var navigationNode = DocumentHelper.GetDocuments()
            .Types("my.navigation")
            .WhereEquals("NavigationType", docType)
            .Published()
            .WithCoupledColumns()
            .NestingLevel(1)
            .TopN(1)
            .FirstOrDefault();

Even if we comment everything out except the first line:

var navigationNode = DocumentHelper.GetDocuments()
            //.Types("my.navigation")
            //.WhereEquals("NavigationType", docType)
            //.Published()
            .WithCoupledColumns()
            .NestingLevel(1)
            .TopN(1)
            .FirstOrDefault();

We're wondering if it's related to the ASPState table or not, but all permissions appear to be allowed on that database as well.

Anyone have any ideas?

Recent Answers


Eugene Paden answered on August 30, 2022 19:47

Is the dev connecting to a local database or a shared database? First thing to check is the connection string.

Does the CMS Admin site work on this Dev's instance?

1 votesVote for this answer Mark as a Correct answer

Cory Kratz answered on August 30, 2022 20:06 (last edited on August 30, 2022 20:07)

The CMS admin site works on the dev's instance just fine. I can see the documents within the CMS tree (Pages section of Kentico) on both the working dev's machine as well as the non-working dev's machine.

It's a local database on each dev's local SQL instance, we currently aren't using a shared database for local development, only our staging instances.

The connection strings are all setup correctly, and we verified that the non-working user can access the databases directly within SSMS with both the ASPState database as well as the Kentico database.

1 votesVote for this answer Mark as a Correct answer

Eugene Paden answered on August 30, 2022 20:19

You can try using DocumentQuery and see if you get results from it.

1 votesVote for this answer Mark as a Correct answer

Cory Kratz answered on August 31, 2022 23:29

DocumentQuery query = new DocumentQuery();
var results = query.All().Result;

Returns results on the developer's machine. This one is a little baffling.

1 votesVote for this answer Mark as a Correct answer

Eugene Paden answered on September 6, 2022 17:19 (last edited on September 6, 2022 17:20)

How about trying just:

var navigationNode = DocumentHelper.GetDocuments()    
            //.Types("my.navigation")
            //.WhereEquals("NavigationType", docType)
            //.Published()
            //.WithCoupledColumns()
            //.NestingLevel(1)
            .TopN(1)
            .FirstOrDefault();
3 votesVote for this answer Mark as a Correct answer

Cory Kratz answered on September 12, 2022 18:04

Unfortunately it's still coming back null.

We're going to try and submit a bug ticket using the "Support" link on the top to try and see if we can get other eyes on this as well (Not that I don't appreciate your messages and feedback! Muchly appreciated! :))

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.