From d62222eaf8a0e87115eb0dff29a6a6d653d0931c Mon Sep 17 00:00:00 2001 From: angel ignacio colmenares laguado Date: Sun, 29 Oct 2017 19:07:45 -0500 Subject: [PATCH 1/2] Update X509CertificateDatabase.cs Fix: NetStandard does not support method GetBytes, use method GetFieldValue instead --- MimeKit/Cryptography/X509CertificateDatabase.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MimeKit/Cryptography/X509CertificateDatabase.cs b/MimeKit/Cryptography/X509CertificateDatabase.cs index 1f8bb67ad5..55d9791bcc 100644 --- a/MimeKit/Cryptography/X509CertificateDatabase.cs +++ b/MimeKit/Cryptography/X509CertificateDatabase.cs @@ -132,13 +132,18 @@ protected int SaltSize { static int ReadBinaryBlob (DbDataReader reader, int column, ref byte[] buffer) { long nread; - +#if NETSTANDARD + buffer= reader.GetFieldValue (column); + nread = buffer.Length; + return (int) nread; +#else // first, get the length of the buffer needed if ((nread = reader.GetBytes (column, 0, null, 0, buffer.Length)) > buffer.Length) Array.Resize (ref buffer, (int) nread); // read the certificate data return (int) reader.GetBytes (column, 0, buffer, 0, (int) nread); +#endif } static X509Certificate DecodeCertificate (DbDataReader reader, X509CertificateParser parser, int column, ref byte[] buffer) From 8300ca449e3eb9c27906685b7b89f8396cc9cb69 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sun, 29 Oct 2017 21:48:00 -0400 Subject: [PATCH 2/2] Fixed coding style --- MimeKit/Cryptography/X509CertificateDatabase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MimeKit/Cryptography/X509CertificateDatabase.cs b/MimeKit/Cryptography/X509CertificateDatabase.cs index 55d9791bcc..5d7eb2122e 100644 --- a/MimeKit/Cryptography/X509CertificateDatabase.cs +++ b/MimeKit/Cryptography/X509CertificateDatabase.cs @@ -131,12 +131,12 @@ protected int SaltSize { static int ReadBinaryBlob (DbDataReader reader, int column, ref byte[] buffer) { - long nread; #if NETSTANDARD - buffer= reader.GetFieldValue (column); - nread = buffer.Length; - return (int) nread; + buffer = reader.GetFieldValue (column); + return (int) buffer.Length; #else + long nread; + // first, get the length of the buffer needed if ((nread = reader.GetBytes (column, 0, null, 0, buffer.Length)) > buffer.Length) Array.Resize (ref buffer, (int) nread);