-
-
Notifications
You must be signed in to change notification settings - Fork 834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mailkit 3.4.3 / MsgReader 4.4.x compatibility #1495
Comments
This is effectively a duplicate of jstedfast/MimeKit#872 |
AFAICT, it's unfixable (by MimeKit/MailKit) because it all comes down to which other libraries you are using and which version(s) of System.Runtime.CompilerServices.Unsafe they depend on. All of the stars need to align or it won't work. ...Unless you switch to .NET Core, then everything works fine. |
The only thing I do is getting the MailKit and MsgReader packages from nuget and they don't work together any more. But it seems using .Net 4.7.2 you are depending on it - there is a hint on https://stackoverflow.com/questions/62764744/could-not-load-file-or-assembly-system-runtime-compilerservices-unsafe The bug that causes this issue is fixed in System.Runtime.CompilerServices.Unsafe 4.6.0. Use binding redirects, to load the specific version of the assembly that you need. Insert this snippet into all of your app.config files. You need to specify the assembly version of the assembly that you need as newVersion. This is not the same as the package version that you choose when installing your NuGet package. They correspond like this:Package 4.5.3 contains assembly version is 4.0.4.1 |
https://stackoverflow.com/a/62769681/87117 The answer is correct, but it's not something that can be done in MimeKit or MailKit. It has to be done by you in your app project. |
Yes, I think that in my case the other NuGet package must have a reliance on an older Unsafe assembly that is not compatible with 6.0.0 So I am just stuck with the older MimeKit. As mentioned by @jstedfast the proper solution is to see if the other NuGet vendor can upgrade Unsafe to 6.0.0 too. Or, you use the binding redirect approach you found out (assuming it will work - and it does not for me). |
Neither is the "use the binding redirect approach" working for me (or I would not have opened an issue here). So I am stuck with MsgReader 3.2.1 until I migrate everything to 6.0.0.0. |
** I updated MsgReader from 3.2.1 to V4.4.2.
Mailkit 3.4.3 seems to have a dependency to System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 while MsgReader 4.4.15 refers to System.Runtime.CompilerServices.Unsafe, Version=5.x.x.x probably through SixLabors.ImageSharp >= 2.1.3
Could you have a look and fix the dependencies?
**Platform **
Exception
exception: 0x1e84ccb - System.IO.FileLoadException: Die Datei oder Assembly "System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)
bei MailKit.Net.Imap.ImapEngine.d__152.MoveNext()
bei MailKit.Net.Imap.ImapClient.d__108.MoveNext()
bei MailKit.Net.Imap.ImapClient.Connect(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)
To Reproduce
Steps to reproduce the behavior:
2 create an IMAPClient Object
Expected behavior
Connect should work with MsgReader 4.4.15, MailKit 3.4.x and System.Runtime.CompilerServices.Unsafe, Version=5.x.x.x
Code Snippets
If applicable, add code snippets to help explain your problem.
using (var client = new ImapClient())
{
try
{
The text was updated successfully, but these errors were encountered: