For .NET Framework version ≥4.5.2, this is safe by default. XmlDocument can become unsafe if you create your own nonnull XmlResolver with default or unsafe settings. If you need to enable DTD ...