System.Buffers, System.Runtime.CompilerServices.Unsafe, etc cannot be loaded
jstedfast opened this issue · 7 comments
jstedfast commented
Describe the bug
I keep getting reports of my MimeKit and MailKit libraries throwing Exceptions trying to load System.Buffers and System.Runtime.CompilerServices.Unsafe.
Some examples:
- System.Runtime.CompilerServices.Unsafe
- System.Buffers:
To Reproduce
I haven't been able to reproduce it myself, but apparently, it's enough to add the MimeKit nuget package to a project and then create a new MimeMessage:
Install-Package MimeKit
void Main()
{
var message = new MimeKit.MimeMessage ();
}
Exceptions (if any)
System.IO.FileLoadException
HResult=0x80131040
Message=Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=System.Memory
StackTrace:
at System.Span`1..ctor(T[] array)
at MimeKit.Utils.ValueStringBuilder..ctor(Int32 initialCapacity)
at MimeKit.Utils.Rfc2047.Encode(FormatOptions options, Encoding charset, String text, Boolean phrase)
at MimeKit.Header.EncodeUnstructuredHeader(ParserOptions options, FormatOptions format, Encoding encoding, String field, String value)
at MimeKit.Header.EncodeAddressHeader(ParserOptions options, FormatOptions format, Encoding encoding, String field, String value)
at MimeKit.Header.FormatRawValue(FormatOptions format, Encoding encoding, String value)
at MimeKit.Header.SetValue(FormatOptions format, Encoding encoding, String value)
at MimeKit.Header..ctor(Encoding encoding, HeaderId id, String value)
at MimeKit.HeaderList.set_Item(HeaderId id, String value)
at MimeKit.MimeMessage..ctor()
at SharpLibTestApp.MailKitForm.button1_Click(Object sender, EventArgs e) in C:\Users\Jamal\Documents\Visual Studio 2022\Projects\SharpLib\SharpLibTestApp\MailKitForm.cs:line 75
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at LimoWizCSharpLibTestApp.Program.Main() in C:\Users\Jamal\Documents\Visual Studio 2022\Projects\SharpLib\CSharpLibTestApp\Program.cs:line 25
Further technical details
- Include the output of
dotnet --info
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version