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 for Bug 9457 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 3189 [details]
Test program which runs OK on Windows, fails on Mono
When using Microsoft's Exchange Web Services (EWS) library under Mono, file attachment contents are corrupted, typically by losing a few bytes. There was an original bug report 762529 in Novell's Bugzilla; I have made a test program which I hope you can use to reproduce the error.
EWS is an XML-based API to fetch message details (including attachments) from a Microsoft Exchange server. On the wire it uses base64 encoding for the attachment contents. Somehow, the EWS code running under Mono on Linux performs the base64 decoding wrongly so that the file is corrupted at 8192 byte intervals. (On Windows with .NET it works fine.) Yet if you take the base64 encoded string directly from the server's XML response and decode it with the standard FromBase64String method, it gives the correct result. I don't know what exactly EWS is doing, and it may be that the EWS client library is buggy. Nonetheless I think this should also be considered a Mono bug because EWS is a commonly used library from Microsoft and it shouldn't do something different (and wrong) under Mono compared to .NET.
Attached is a test program to demonstrate the problem. You run it passing details of the server to connect to:
- domain name for login
- user name for login
- password for login
- name of a folder - e.g. 'Inbox', or a public folder name. This should contain some messages with attachments.
- max number of messages to fetch
I tested against Exchange Server 2010 and built with version 22.214.171.124 (runtime version v2.0.50727) of Microsoft.Exchange.WebServices. On Windows I used .NET Framework 4.5. On Linux I reproduced the bug with both Mono 2.10.5 and 2.10.8. (The earlier bug report found this behaviour with 2.10.2.)
The program works by first fetching attachment content in the usual way with EWS and then doing it 'by hand' by fishing out the base64 text from the server response and decoding it. The two should give the same result. On Windows with .NET the program runs without error but on Mono it will find an attachment where EWS decodes incorrectly.
Please let me know whether you have access to an Exchange Server to reproduce this on or any idea what might be going wrong. If not, I might have to dig into the EWS client library's code, but I have not done that so far because I don't think the client library is free software.
I also observe this bug with 3.0.3.
I'm having an issue with corrupt base64 encoded PNG images being sent from iPads to a web server. This seems like a likely culprit.
Interesting. It would be great if you could find a test case that doesn't involve Microsoft Exchange...