解决方法
如果您这样保存,您应该没有任何问题.
using (var file = new FileStream(filePath,FileMode.OpenOrCreate,FileAccess.Write,FileShare.None)) { xmlDoc.Save(file); }