The NullReference exception is thrown in CoreLab.Security.as

The NullReference exception is thrown in CoreLab.Security.as

Postby AlexL » Thu 19 Nov 2009 16:13

Hey!
Environment

Windows XP SP3, .NET 3.5 SP 1, 3.0 SP2, 2.0 SP2
Library version: 4.70.23.0

Description

The issue occurs when I try to open ssl connection (all my certificates were checked with mysql client and everything worked fine). Here is the stack trace of exception which I catch by UnhandledException event:


CoreLab.Security.SSL.as.a(Exception A_0)
CoreLab.Security.SSL.as.f(IAsyncResult A_0)
System.Net.ContextAwareResult.CompleteCallback(Object state)
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
System.Net.ContextAwareResult.Complete(IntPtr userToken)
System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)


What does it mean?

Code: Select all
var connectionString = "server=localhost;database=test;uid=ssluser;pwd=sslpass;protocol=ssl;Connection timeout=150;"
var mySqlConnection = new MySqlConnection(connectionString);
mySqlConnection.SslOptions.CACert = @"file://" + caCertificate;
mySqlConnection.SslOptions.Cert = @"file://" + userCertificate;
mySqlConnection.SslOptions.Key = @"file://" +  userPrivateKey;
try
{
     mySqlConnection.Error += mySqlConnection_Error;

     mySqlConnection.Open();
}
catch (MySqlException e)
{
      // log exception message
}
AlexL
 
Posts: 3
Joined: Thu 19 Nov 2009 15:44

Postby Shalex » Fri 20 Nov 2009 13:39

Please try the latest 5.50.54 version of dotConnect for MySQL (we have checked this version, it works fine). Is your current version 4.70.28 or 4.25.23?
Shalex
Devart Team
 
Posts: 7616
Joined: Thu 14 Aug 2008 12:44

Postby AlexL » Fri 20 Nov 2009 13:48

I updated files to 5.20 and the error has gone. But, I still can not connect to server through SSL. Now 'SSL Connection error (2026)' message pops up. The certificates are fully ok, I have checked them by connection using mysql client.

Here is code that I'm using and it looks like from documentation to dotConnect:
Code: Select all
var connectionString = "host=localhost;database=test;user=ssluser;password=sslpass;protocol=SSL";

var mySqlConnection = new MySqlConnection(connectionString);

mySqlConnection.SslOptions.CACert = "file://C:\Test\cacert.pem";//
mySqlConnection.SslOptions.Cert = "file://C:\Test\01.pem";//
mySqlConnection.SslOptions.Key = "file://C:\Test\key.pem";//

try
{
       mySqlConnection.Error += mySqlConnection_Error;

       mySqlConnection.Open();
}
catch (MySqlException e)
{
       // log error
}
catch (Exception ex)
{
       // log error
}

private static void mySqlConnection_Error(object sender, MySqlErrorEventArgs e)
{
       // log error
}
AlexL
 
Posts: 3
Joined: Thu 19 Nov 2009 15:44

Postby Shalex » Fri 20 Nov 2009 14:05

Could you please try the 5.50.54 version?
Shalex
Devart Team
 
Posts: 7616
Joined: Thu 14 Aug 2008 12:44

Postby AlexL » Fri 20 Nov 2009 14:23

Yeah, it works.
AlexL
 
Posts: 3
Joined: Thu 19 Nov 2009 15:44


Return to dotConnect for MySQL