Work done by force on block against gravity and friction up irregular rough incline? 
I recently found a question which I think is from Irodov which asked about the work done by a force $F$ on a body of mass $M$ up a rough hill. At each point in the path of the body the force is tangential to to the hill. Now in the solution to this question, it is eventually proven that the work done by the force $F$ is $\mu mgx + mgy$, hence proving that the path trajectory does not matter in the net work done. 
The work done against friction is found to be $\mu mgx $ through integration of the work done against friction $\mu mg\cosθ\,{\rm d}l$ where ${\rm d}l$ is a minute distance travelled by the body and $\mu mg\cosθ$ gives the normal force and I understood the method. 
However all this while I have learnt that work done by a non-conservative force such as friction depends on the path traversed. Is that incorrect? Or if it is correct and applied only to certain cases, what cases is it applied to? What has gone wrong in my understanding?
 A: Since the force is tangential to the hill, and the hill is bumpy, the force must be constantly changing direction, and it is changing direction based on the path. 
So this is not a case in which there is a particular non-conservative force, and several different paths that have the same work. This is a case where there are different paths, and a different force for each one. 
That said, it is possible for a fixed non-conservative force to have multiple paths that have the same work. Non-conservative just means that given a particular path, there is some path with a different work, not that all paths have a different work. 
Note that if you reverse this path, then the sign of the gravitational work will be reversed, while the friction work will remain the same. Thus, simply taking the reverse path results in a different amount of work. Also, if the object were moved in two different horizontal direction, then the work would increase. If the object were moved along switch-backs (moving back and forth in the x direction while increasing y position), then the work would be based on the total distance traveled, rather than the displacement.
