[tuner] Properly preserve AesCryptoServiceProvider.
authorJonathan Pryor <jonp@xamarin.com>
Thu, 13 Jun 2013 20:56:18 +0000 (16:56 -0400)
committerRadek Doulik <rodo@xamarin.com>
Wed, 21 Oct 2015 08:27:38 +0000 (10:27 +0200)
commit14c3c74b1ea89da7fad24f8266263be74b1d9fd8
tree1a84c63f30b54872e4e141ab60d14abe110fea6f
parent8eae19473d83ac3bf5bb3096da1c82a94d8e33cb
[tuner] Properly preserve AesCryptoServiceProvider.

[merged by rodo from monodroid - the mentioned test is not included here]

Fixes: https://xamarin.desk.com/agent/case/35534

Commit 5ca3cb4b wasn't propertly tested (doh!).

The problem with Aes and AesCryptoServiceProvider is that there's a
cross-assembly dependency: Aes is in mscorlib, while
AesCryptoServiceProvider is in System.Core. The
PreserveCrypto.ProcessSystemCore() method didn't properly handle this
setup.

Fix the linker, and add a test to Hello.

WARNING: The test sucks. In particular, to "test" this fix you need to
run the app and then grep the `adb logcat` output for:

# DownloadDataTaskAsync complete; status=RanToCompletion; exception=

If the status is anything else, or the exception is non-null, it's
busted.

FURTHERMORE, it's only useful in Release apps, not Debug apps.
(No linker in Debug apps.)

The reason for the need to grep is that there's no sane mechanism to
wait until the Task has completed before checking the status of the
Task, and throwing an exception from within the continuation wouldn't
do anything.

FIXME: The real problem is that Task.Wait() blocks forever and never
returns. This needs further investigation.

https://bugzilla.xamarin.com/show_bug.cgi?id=12681
mcs/tools/tuner/Mono.Tuner/PreserveCrypto.cs