I am using Mailkit 2.15 which is dependent on MimeKit 2.15 which is dependent on System.Buffers 4.5.1. In VS Code this works fine but when ran directly in PS then it tries to load System.Buffers 4.0.2.0 which is not installed or even available on nuget. Another strange thing is that even if I comment out the line to load System.Buffers it still works in VS Code and the same error happens in PS.
Exception calling “Send” with “1” argument(s): “Could not load file or assembly ‘System.Buffers, Version=4.0.2.0,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The system cannot find the file
specified.”