Repository navigation
Does MailKit continue to work with UWP (.NET Native)? #2022
|
After updating the MailKit package version from 4.17.0 to 4.18.0, my UWP (old-style) project fails to build in the Release configuration. |
Replies: 1 comment 1 reply
|
The error doesn't come from MailKit's own code but from a dependency that changed in 4.18.0. Comparing the netstandard2.0 dependencies on NuGet:
For an old-style UWP project, the practical option is to stay on MailKit and MimeKit 4.17.0. You can't pin Longer term, .NET Native only gets maintenance fixes and newer libraries will keep running into this. UWP apps can now target modern .NET (since .NET 9) with Native AOT instead, which doesn't have this restriction, so that's the way to keep getting MailKit updates. |
The error doesn't come from MailKit's own code but from a dependency that changed in 4.18.0. Comparing the netstandard2.0 dependencies on NuGet:
System.Security.Cryptography.Pkcs8.0.1.System.Security.Cryptography.Pkcs10.0.0 (and MailKit movedSystem.Formats.Asn1from 8.0.1 to 10.0.0).System.Security.Cryptography.Pkcs10.0.0 adds a new dependency for netstandard2.0,Microsoft.Bcl.Cryptography10.0.0, and that package includes theBCryptSetPropertyP/Invoke from your error, which passes aReadOnlySpan<byte>to native code. The .NET Native compiler can't marshal spans across P/Invokes, so it fails. It only shows up in Release because that's the c…