You are adding ProjectVersionMileStone twice. In my opinion, this should be:
RelationCollection relations = new RelationCollection();
relations.Add(MileStoneEntity.Relations.ProjectVersionMileStoneEntityUsingMileStoneId);
realtions.Add(ProjectVersionMileStoneEntity.Relations.ProjectEntityUsingProjectId);
realtions.Add(ProjectVersionMileStoneEntity.Relations.VersionEntityUsingVersionId);
As a matter of fact, the fields you are filtering are all in the intermediate table ProjectVersionMileStone, so you just need that relation. Your could would ends like this:
internal static MileStoneCollection GetMileStonesForProjectAndVersion(int projectId,int versionId)
{
PredicateExpression expression = new PredicateExpression();
expression.Add(ProjectVersionMileStoneFields.ProjectId == projectId);
expression.AddWithAnd(ProjectVersionMileStoneFields.VersionId == versionId);
expression.AddWithAnd(MileStoneFields.IsDeleted == false);
RelationCollection relations = new RelationCollection();
relations.Add(MileStoneEntity.Relations.ProjectVersionMileStoneEntityUsingMileStoneId);
return GetMileStones(expression, null, relations);
}
Hope helpful.