At undergraduate level, I've just been taught that the line integral along a closed path in the x-y plane should be equal to $0$. However, see the following example, calculating the work done along the z-axis from $1$ to $-1$ and then the arc of radius $1$ connected the two points by the force.
\begin{aligned} &\underline{F}=\frac{-yi+xj}{\sqrt{x^2+y^2}}\\ W&=\int_{arc}^{} -y dx + x dy\\ &=\int_{\pi}^{0} d\theta \end{aligned} Which gives $-\pi$ (Excuse the brief method - typing on a phone is less that fun for MathJax).
Am I missing something here?
It sounds as if what you were taught about line integrals was incomplete. For the integral to vanish over all closed paths the integrand must meet certain conditions, one of the most important of which is that it’s defined everywhere in the region enclosed by the path (more precisely, the function’s domain must be contractible to a point). Your function is undefined at the origin, so the integral over a closed path that encloses the origin might not vanish, as you’ve seen for yourself. If the domain doesn’t have a hole like this, another condition is that the function’s curl must vanish, but for your function $$\nabla\times F = {1\over\sqrt{x^2+y^2}},$$ which vanishes nowhere, so even integrals over closed paths that don’t surround the origin aren’t guaranteed to vanish, either.