Is it possible that the expert has been marked as removed?
No, he's not marked as removed.
I might be completely wrong on this, but it seems a lot like it's using intQuestionID when selecting the Expert, and the intExpertID when selecting the Question.
I've only got one expert, with ID = 1.
After I first posted I noticed that it always gives me the first Question (question with ID=1) in the AssignedQuestion, even though the AssignedQuestion ID is correct.
If I get AssignedQuestion with ID=1, then I get the correct Question, and also the Expert (probably because they are mixed up, and intQuestionID = the only ID that matches an Expert).
ExpertHandler.GetAssignedQuestion(1) : Question.ID = 1, Expert.ID = 1
ExpertHandler.GetAssignedQuestion(5) : Question.ID = 1, Expert = null
This is what my AssignedQuestions table looks like:
intID intQuestionID intExpertID
1 1 1
2 2 1
5 8 1
With both GetAssignedQuestion and with GetQueryResult.
This is solved in the latest hotfix for EPiServer Community:
"Hotfix 4 - EPiServer Community 3.1.4" - which can be found in the download section.
This is of course also solved in EPiServer Community 3.2.
I'm trying to get an AssignedQuestion with ExpertHandler.GetAssignedQuestion(id) and/or with ExpertHandler.GetQueryResult(assignedQuestionQuery), but the Expert property just returns null, while the Question property returns the proper question.
Looking in the table for AssignedQuestions, I can see the id for the Expert.