6. Given that $x_{1}, x_{2}$ are the two real roots of the equation $x^{2}-(k-2) x+\left(k^{2}+3 k+5\right)=0$ (where $k$ is a real number), the maximum value of $x_{1}^{2}+x_{2}^{2}$ is
A. 19
B. 18
C. $5 \frac{5}{9}$
D. Does not exist
$$
\begin{array}{l}
\text { Given } \Delta=(k-2)^{2}-4\left(k^{2}+3 k+5\right) \geqslant 0 \Rightarrow 3 k^{2}+16 k+16 \leqslant 0 \Rightarrow-4 \leqslant k \leqslant-\frac{4}{3} \\
\Rightarrow x_{1}^{2}+x_{2}^{2}=\left(x_{1}+x_{2}\right)^{2}-2 x_{1} x_{2}=(k-2)^{2}-2\left(k^{2}+3 k+5\right)=-k^{2}-10 k-6 \\
=-(k+5)^{2}+19 \leqslant 18 \text {, equality holds when } k=-4 \text {. Therefore, the answer is } B .
\end{array}
$$