We are given the differential equation:
\[
x \frac{dy}{dx} = y + x \tan\left(\frac{y}{x}\right)
\]
This is a form of a differential equation that can be solved by the substitution \( v = \frac{y}{x} \). Thus, \( y = vx \), and therefore:
\[
\frac{dy}{dx} = v + x \frac{dv}{dx}
\]
Substitute this into the original equation:
\[
x (v + x \frac{dv}{dx}) = vx + x \tan(v)
\]
Simplify:
\[
xv + x^2 \frac{dv}{dx} = vx + x \tan(v)
\]
Cancel out \( xv \) from both sides:
\[
x^2 \frac{dv}{dx} = x \tan(v)
\]
Now divide both sides by \( x^2 \):
\[
\frac{dv}{dx} = \frac{\tan(v)}{x}
\]
This equation can now be separated:
\[
\frac{1}{\tan(v)} dv = \frac{1}{x} dx
\]
Integrate both sides:
\[
\int \frac{1}{\tan(v)} dv = \int \frac{1}{x} dx
\]
The integral of \( \frac{1}{\tan(v)} \) is \( \ln|\sin(v)| \), and the integral of \( \frac{1}{x} \) is \( \ln|x| \), so we get:
\[
\ln|\sin(v)| = \ln|x| + C
\]
Exponentiate both sides:
\[
|\sin(v)| = Cx
\]
Thus, we have:
\[
\sin\left( \frac{y}{x} \right) = Cx
\]
Therefore, the general solution is \( \sin\left( \frac{y}{x} \right) = Cx \).