Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I use the following code:
System.Net.WebClient webClient = new System.Net.WebClient();
string webAddress = "https://sd2dav.1und1.de/"; //1&1 Webdav
string destinationFilePath = webAddress + "testfile.txt";
webClient.Credentials = new System.Net.NetworkCredential("myuser", "mypassword");
Stream stream = webClient.OpenWrite(destinationFilePath,"PUT");
UnicodeEncoding uniEncoding = new UnicodeEncoding();
using(StreamWriter sw = new StreamWriter(stream, uniEncoding))
This works fine when compiled with Visual Studio 2008, .net 3.5 and executed on Windows 7. However, I would like to do this with Mono for Android (4.4.54). Here, the code executes, but nothing happens: The file is not created on the server.
Using the same code this also happens on Linux using mono 3.0.6 (Debian packages).
This used to work with the previous version in Debian, which was 22.214.171.124
This also breaks Keepass2 when trying to save to Webdav (also see https://sourceforge.net/p/keepass/bugs/1117/).
This might be related: http://stackoverflow.com/questions/16482956/is-httpwebrequest-implemented-differently-in-mono-and-net
The sync API is working perfectly fine; the async one needs a small fix that I already have a patch for.
However, there's another issue with OpenWrite(): we need to wait for and actually read the response from the server when closing the stream. This does not seem to happen yet.
Note that WebClient.OpenWriteAsync() and WebClient.OpenWriteTaskAsync() is not actually "async" - these APIs should be avoided in async applications.