Specified method not supported
I had a great chance to write some kick-ass Silverlight code last week as a proof of concept for a potential new business venture the company I work at is thinking about, and hopefully in six months to a year, I'll be able to talk about it. The final solution won’t be Silverlight-based, but for the POC, it provided the delivery method, functionality, and UI to get the message across.
[
]
Part of that POC was to load and parse a local XML file (local as in on the server) when the application was open. The only way to do that is by using the WebClient class and calling the DownloadStringAsync method with the URI to the XML file, then parsing it into an XDocument. Not rocket science at all—but when I tried it, I kept getting the message:
An exception of type 'System.NotSupportedException' occurred in System.Windows.dll but was not handled in user code Additional Information: Specified method not supported.
No matter what I tried, I couldn’t get it to work. Eventually, I figured out that it was only happening when debugging or running from within Visual Studio. Publishing it to an actual web server and running it as a user worked perfectly fine. This is a big issue for me, since it makes ad-hoc testing and debugging very difficult. Thankfully, it was just a POC—but this could be a major pain for serious projects.