Mailkit: Xamarin.Mac is crashing using MailKit

Created on 3 Jan 2018  路  12Comments  路  Source: jstedfast/MailKit

I am using Xamarin.Mac app with Mailkit. When trying to send an email, dotnet crashes with following:

2018-01-03 17:18:28.789 Host Health Check[52524:67516605] error: * Assertion at /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/external/mono/mono/mini/method-to-ir.c:13203, condition `ins->opcode >= MONO_CEE_LAST' not met
Stacktrace:

  at <unknown> <0xffffffff>
  at System.Collections.Generic.Dictionary`2<string, int>.TryInsert (string,int,System.Collections.Generic.InsertionBehavior) [0x00022] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.0.0.214/src/mono/external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs:394
  at System.Collections.Generic.Dictionary`2<string, int>.Add (string,int) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/4.0.0.214/src/mono/external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs:234
  at MimeKit.Utils.CharsetUtils.AddAliases (System.Collections.Generic.Dictionary`2<string, int>,int,int,string[]) [0x00016] in <d5f7667599864daa93b9b9acae999238>:0
  at MimeKit.Utils.CharsetUtils..cctor () [0x0008a] in <d5f7667599864daa93b9b9acae999238>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0001f] in <4da6dbd392f94d55a208a24fb92b2aa1>:0
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_generic_class_init (intptr) [0x00007] in <4da6dbd392f94d55a208a24fb92b2aa1>:0
  at MimeKit.ParserOptions..ctor () [0x00027] in <d5f7667599864daa93b9b9acae999238>:0
  at MimeKit.ParserOptions..cctor () [0x00018] in <d5f7667599864daa93b9b9acae999238>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0001f] in <4da6dbd392f94d55a208a24fb92b2aa1>:0
  at <unknown> <0xffffffff>

on the line

var message = new MimeMessage();

Any idea?

question

Most helpful comment

Confirmed! That is working.

All 12 comments

This is a bug in the Xamarin.Mac runtime, but perhaps you can work around it by making sure that your app includes all of the I18N assemblies?

Go to your Project Options and make sure to check all the I18N checkboxes.

Whether that works or not, please submit a bug to Xamarin so that they can fix this. Thanks!

Ok, I will wait for the fix then; tried your suggestion without any luck.

Question: what .NET framework is being referenced for the MimeKit assembly? Is it netstandard?

And can you link me to the bug you submitted to Xamarin (or let me know who you talked to)? I'd like to track this bug myself.

I would like to think that this is already logged, and ready soon:
https://bugzilla.xamarin.com/show_bug.cgi?id=60625

  <package id="MailKit" version="2.0.0" targetFramework="xamarinmac20" />
 <HintPath>packages\MailKit.2.0.0\lib\netstandard2.0\MailKit.dll</HintPath>

I'm talking to the Xamarin.Mac devs now and they haven't heard about this issue.

Do you think you could write up a small test project that reproduces this issue so that I could pass it along to them?

Can you try downloading/installing the package from here to see if that fixes it? https://jenkins.mono-project.com/view/Xamarin.MaciOS/job/macios-mac-d15-5/

That contains the fix for the bug that you linked to.

You'll probably need to Clean and then re-build your project so that it embeds the latest mono runtime.

Confirmed! That is working.

Awesome :)

@jstedfast I have the same issue and I installed this package: xamarin.mac-4.0.0.216.pkg
From the link you had provided.

I am still facing the issue on my mac when I try to invoke a small program that sends an email.
I do have the nuget package installed, would you recommend starting a new project and installing the nuget package.

You could try starting a fresh project. The patch has also been released in official packages already, so you shouldn鈥檛 need to use the Xamarin.Mac package linked above for things to work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wayneguow picture wayneguow  路  5Comments

Radzhab picture Radzhab  路  3Comments

dbogatov picture dbogatov  路  7Comments

ghost picture ghost  路  3Comments

TysonMN picture TysonMN  路  5Comments