Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] iOS Release Configuration: Linker errors when using Cryptography #14017

Open
fhintsch opened this issue Mar 16, 2021 · 3 comments
Open
Labels
p/iOS 🍎 s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛
Projects

Comments

@fhintsch
Copy link

Description

Linker issues occur in iOS Release configuration only when using Mailkit, i.e. Cryptography.
Error: MT2101, Warnings: MT0109, MSB3276

Steps to Reproduce

  1. VS for Mac, current version: Create a new project by using standard Xamarin Forms template.
  2. Add Nuget package Mailkit 2.11.0.
  3. Create a class "Mail" that uses Mailkit.Security and Mimekit.
  4. Run this project with Platform iOS and Configuration Release

Expected Behavior

The link phase should run without any errors and warnings. If there were warnings, I should be enabled to avoid them.

Actual Behavior

Platform iOS and Configuration Release do not link successful. Error: MT2101, Warnings: MT0109, MSB3276.
All other Platform|Configuration combination link successful, although there are warnings.

Basic Information

  • Version with issue:
  • Last known good version:
  • Platform Target Frameworks:
    • iOS: Xamarin.iOS.framework/Versions/14.14.2.5
    • Android:
    • UWP:
  • Android Support Library / AndroidX Version:
  • NuGet Packages:
    • xamarin.forms/5.0.1.2023-nightly
    • MailKit, Version=2.11.0.0
  • Affected Devices:

Environment

Show/Hide Visual Studio info
=== Visual Studio Community 2019 for Mac ===

Version 8.9.1 (build 34)
Installation UUID: c63d4ddb-4398-4935-a384-ca72c29bb572
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000122

=== Mono Framework MDK ===

Runtime:
	Mono 6.12.0.122 (2020-02/c621c35ffa0) (64-bit)
	Package version: 612000122

=== Roslyn (Language Service) ===

3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.201/Sdks
SDK-Versionen:
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.403
MSBuild-SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core-Runtime ===

Laufzeit: /usr/local/share/dotnet/dotnet
Laufzeitversionen:
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.9
	3.1.8

=== .NET Core 3.1 SDK ===

SDK: 3.1.407

=== Xamarin.Profiler ===

Version: 1.6.12.26
Speicherort: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Version: 7.8.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:43-0500

=== Xamarin.Android ===

Version: 11.2.0.21 (Visual Studio Community)
Commit: xamarin-android/d16-9/93eab59
Android SDK: /Users/frankhintsch/Library/Developer/Xamarin/android-sdk-macosx
	Unterstützte Android-Versionen:
		Keine installiert

Version von SDK Tools: 26.1.1
Version der SDK-Plattformtools: 29.0.6
Version der SDK-Buildtools: 29.0.2

Buildinformationen: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@d6d86b2
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.34.1@daff8f4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@9d8924d

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/frankhintsch/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL-Code ist hier verfügbar:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.9.0.22
Hash: a391de2
Branch: remotes/origin/d16-9
Build date: 2021-02-18 03:14:56 UTC

=== Android Device Manager ===

Version: 16.9.0.17
Hash: fc2b3db
Branch: remotes/origin/d16-9
Build date: 2021-02-18 03:15:18 UTC

=== Xamarin Designer ===

Version: 16.9.0.316
Hash: bd2705417
Branch: remotes/origin/d16-9
Build date: 2021-02-24 00:16:08 UTC

=== Xamarin.iOS ===

Version: 14.14.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:44-0500

=== Build Information ===

Release ID: 809010034
Git revision: 33bce2b7f3d45d05865cd3282f1c2cdc3a112aa0
Build date: 2021-03-04 11:21:38-05
Build branch: release-8.9
Xamarin extensions: 33bce2b7f3d45d05865cd3282f1c2cdc3a112aa0

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.3.0 Darwin Kernel Version 20.3.0
    Thu Jan 21 00:07:06 PST 2021
    root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64


Build Logs

using "msbuild" on command line I cannot reproduce the error.
msbuild -bl:linktest.binlog -p:Configuration=Release linktest.iOS.csproj

With VS I got the errors, see linktest-log.txt.zip
linktest-clone.zip
linktest-log.txt.zip

Screenshots

Reproduction Link

Workaround

@fhintsch fhintsch added s/unverified New report that has yet to be verified t/bug 🐛 labels Mar 16, 2021
@fhintsch
Copy link
Author

linktest-clone.zip contains the sample project.

@jsuarezruiz jsuarezruiz added this to New in Triage via automation Mar 22, 2021
@rachelkang
Copy link
Contributor

Confirming that I can repro this issue and see this error:

MTOUCH : error MT2101: Can't resolve the reference 'System.Void System.Security.Cryptography.DSACng::.ctor(System.Security.Cryptography.CngKey)', referenced from the method 'T Internal.Cryptography.Pal.Windows.PkcsPalWindows::GetPrivateKey(System.Security.Cryptography.X509Certificates.X509Certificate2,System.Boolean,System.Boolean)' in 'System.Security.Cryptography.Cng, Version=4.3.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

@fhintsch I'm not familiar with the MailKit dependency you're using, but it seems like the issues you're experiencing are related to that dependency and I would try to check with them. If I had to take a guess, I think it could be related to how the password might not be properly secured

@rachelkang rachelkang added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Apr 16, 2021
@rachelkang rachelkang moved this from New to Needs Info in Triage Apr 16, 2021
@ioiooi
Copy link

ioiooi commented Oct 25, 2022

Might be related to xamarin/xamarin-macios#10802 and mono/mono#21118

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p/iOS 🍎 s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛
Projects
Triage
  
Needs Info
Development

No branches or pull requests

4 participants