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.
Created attachment 12087 [details]
Issue demonstration project
I have a PCL that references the HashLib PCL that I use for encryption.
This works fine when I build my iOS app without linking libraries.
When I set it to "link SDK assemblies" however, I get an error while building the iOS project.
MTOUCH: error MT2002: Failed to resolve "System.Void
System.Security.Cryptography.SHA1Cng::.ctor()" reference from
"System.Core, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089"
I've attached an example solution that demonstrates the issue.
As soon as I make a call to the SHA1 encrypting method in HashLib, the linking error occurs.
I tried to exclude HashLib from linking, but that didn't help.
`SHA1Cng` is not a type that is part of XI mobile profile (on Windows this is a CNG provided version of SHA1, which makes not sense out of Windows where CNG is not available).
Either the HashLib assembly is mis-compiled or the wrong PCL profile is used.
I downloaded the HashLib source code and it turns out not to be PCL at all.. missed that completely.
Now I've extracted to code for SHA1 hashing from HashLib, moved it to separate PCL and referenced that in my Xamarin project.
This fixed the issue!