MailKit icon indicating copy to clipboard operation
MailKit copied to clipboard

It doesn't work anymore on the just released .NET Core RC2

Open dsbenghe opened this issue 10 years ago • 19 comments

We were using MailKit on .NET Core RC1.

After upgrading to .NET Core RC2 it stopped working.

Error is

Method not found: 'Void System.Net.Security.SslStream.AuthenticateAsClient(System.String, System.Security.Cryptography.X509Certificates.X509CertificateCollection, System.Security.Authentication.SslProtocols, Boolean

https://github.com/jstedfast/MailKit/blob/8f94120135b15c0b274d7a9a71b2888aa652d9b3/MailKit/Net/Smtp/SmtpClient.cs#L857

dsbenghe avatar May 18 '16 01:05 dsbenghe

just noticed this too ... we're experiencing the same issue ... hopefully its an easy port to rc2

seems like the "AuthenticateAsClient" has been replaced with the Async only version

https://github.com/dotnet/corefx/commit/36270c6ea4741054b48b33be06dafee3438f07b3

liquidboy avatar May 18 '16 01:05 liquidboy

RC2 shipped so hoping for a MailKit/MimeKit update soon. Just saw this issue on stackoverflow http://stackoverflow.com/questions/37297325/asp-net-core-rc2-smtp-client

joeaudette avatar May 18 '16 11:05 joeaudette

https://github.com/jstedfast/MailKit/issues/286#issuecomment-219600725

mikes-gh avatar May 18 '16 12:05 mikes-gh

Yea, I'll be working on the port to RC2 as soon as I get back from my vacation.

jstedfast avatar May 18 '16 17:05 jstedfast

I think I've got MimeKit more-or-less ported to RC2, but I'm getting the following build error that I can't figure out how to fix:

Error CS0234 The type or namespace name 'Resources' does not exist in the namespace 'System' (are you missing an assembly reference?)

This error is on line 2 in the following auto-generated file:

// <auto-generated> This file has been auto generated. </auto-generated>
[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")]
[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v1.4")]

jstedfast avatar May 22 '16 14:05 jstedfast

sounds like something is not referenced quite right, I know there are major changes now in rc2 for how to manage target frameworks/monikers and that is closely related to how dependencies are resolved, this article may shed some light if you haven't seen it yet https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md

joeaudette avatar May 22 '16 15:05 joeaudette

It looks like it has to do with the "language": "en-US" prop in the project.json. Removing that seems to have fixed it.

jstedfast avatar May 22 '16 15:05 jstedfast

Published: https://www.nuget.org/packages/MailKit/1.3.0-rc1

jstedfast avatar May 22 '16 16:05 jstedfast

awesome! Many thanks for your speedy work!

joeaudette avatar May 22 '16 16:05 joeaudette

I took last nuget update 1.3.0-rc1 but it has wrong dependence which can't be resolved(The dependency MimeKit 1.2.24 does not support framework .NETCoreApp,Version=v1.0.). Fix it, please. er

Locally it can be solved adding row MimeKit:1.3.0-rc1 before MailKit in project.json: "MimeKit": "1.3.0-rc1", "MailKit": "1.3.0-rc1"

maxim-melnik avatar May 23 '16 08:05 maxim-melnik

I also have a dependency issue I am building for 4.5.2 and netcoreapp1.0 @MaximusDTI workaround works for me. ] It seem you are using

"dependencies": { 
     "MimeKit": "1.3.0-rc1" 
  } 

But it is getting 1.2.24 in the nuget

Severity    Code    Description Project File    Line    Suppression State
Error   CS1705  Assembly 'MailKit' with identity 'MailKit, Version=1.3.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b' uses 'MimeKit, Version=1.3.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814' which has a higher version than referenced assembly 'MimeKit' with identity 'MimeKit, Version=1.2.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814'    Reports C:\Users\mikes\Repos\Reports\src\Reports\Services\MessageServices.cs    71  
Error   CS1705  Assembly 'MailKit' with identity 'MailKit, Version=1.3.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b' uses 'MimeKit, Version=1.3.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814' which has a higher version than referenced assembly 'MimeKit' with identity 'MimeKit, Version=1.2.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814'    Reports..NET Framework 4.5.2    C:\Users\mikes\Repos\Reports\src\Reports\Services\MessageServices.cs    71  Active
Error   CS0012  The type 'MimeMessage' is defined in an assembly that is not referenced. You must add a reference to assembly 'MimeKit, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null'. Reports C:\Users\mikes\Repos\Reports\src\Reports\Services\MessageServices.cs    71  
Error   CS0012  The type 'MimeMessage' is defined in an assembly that is not referenced. You must add a reference to assembly 'MimeKit, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null'. Reports..NETCoreApp,Version=v1.0    C:\Users\mikes\Repos\Reports\src\Reports\Services\MessageServices.cs    71  Active

mikes-gh avatar May 23 '16 13:05 mikes-gh

https://www.nuget.org/packages/MailKit/1.3.0-rc1-1

jstedfast avatar May 23 '16 13:05 jstedfast

Many thanks will report back once its available.

mikes-gh avatar May 23 '16 13:05 mikes-gh

It works! Thanks for your work on this :clap:

mikes-gh avatar May 23 '16 13:05 mikes-gh

I keep getting this error when trying to update from beta7 to rc1-1

Can anyone assist?

project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "MailKit": "1.3.0-rc1-1",
    "NETStandard.Library": "1.5.0-*"
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": [ "dnxcore50", "portable-net45+win8" ]
    }
  }
}

Package Manager Output

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
C:\Program Files\dotnet\dotnet.exe restore "C:\Proj\.vs\restore.dg"
log  : Restoring packages for C:\Proj\src\Fulcrum.Service\project.json...
info :   CACHE https://api.nuget.org/v3-flatcontainer/netstandard.library/index.json
error: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1.

TrplM avatar May 29 '16 14:05 TrplM

Looks like you have a nul byte at the beginning of your project.json file according to the error you pasted.

jstedfast avatar May 29 '16 20:05 jstedfast

Thanks, unfortunately it only happens when I add the rc1 or rc1-1 dependency. If I remove it completely or add beta7 it restores successfully.

I have also tried to add it to a new pcl project, still no luck. Seems to be a dependency issue but for the life of me I can't figure it out

TrplM avatar May 29 '16 22:05 TrplM

I am using the new version of Mailkit but still doesn't work with .net core rc2

ramon26cruz avatar Jun 09 '16 05:06 ramon26cruz

You would need to expand on "doesn't work". It works for me so it can work.

Myproject.json extract

   "dependencies": {
        "MailKit": "1.3.0-rc1-1",

You might try deleting the contents of your nugget package cache directory C:\Users\{username}\.nuget

And then dotnet restore again.

mikes-gh avatar Jun 09 '16 08:06 mikes-gh