A few times over the last year or so I’ve come across an error while trying to connect to SharePoint Online using CSOM;
Exception calling “ExecuteQuery” with “0” argument(s): “For security reasons DTD is prohibited in this XML document. To enable DTD processing set the Dtd Processing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.”
This post by Paul Ryan offers an explanation and solution, though in my case it didn’t quite work, I was using an account of the <username>@<domain>.onmicrosoft.com variety to connect to SPO which Paul’s post indicates should work.
To fix the situation I had to add 2 entries to my local HOSTS files;
The 2nd host entry is important as if the GET for FPurl.xml fails using the first msoid DNS entry, it then tries using the 2nd DNS entry, msoid.onmicrosoft.com, which does succeed and you are left in the same situation as before.