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
Developer Community or GitHub 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 tested that on xtouch - but I likely forgot to backport (part of) it.
Two workarounds are:
a) add "--linkskip=mscorlib" to the "extra mtouch arguments" (Project Options, iPhone Build). This will skip 'mscorlib.dll' from being processed by the linker and will ensure SHA256 is still available to your application;
b) create an instance of SHA256Managed in your application (even if you do not directly use it). That'll "trick" the linker into including it into your application.
The first option is easier (to add now and remove later) but will make your application a bit larger. The second one is more optimal (for the application size) but a less clean on your code.
This bug affects all HMAC hash types except for HMACSHA1, it is not limited to only HMACSHA256.
Simple workaround code for "option b" above is to put this in your main.cs...
System.Security.Cryptography.SHA256Managed tempCode = new System.Security.Cryptography.SHA256Managed();
So I was wrong (about being wrong ;-). The backports (from comment #1) were done but after MonoTouch 4.0.4 was branched (and 4.0.6 was built from that stable branch).
As such the fix is already available in MonoTouch 4.1 (beta) and will be part of 4.2 (stable) once released.