Connect on 2.0 doesn't work ... sometimes?

Connect on 2.0 doesn't work ... sometimes?

Postby invcmd » Sat 16 Jun 2007 22:25

I'm trying to run unit tests with CoreLab.MySql 3.50.13.0. Under NUnit 2.2.8 and .NET 1.1 with the 1.x version of CoreLab.MySql, it works fine. Under .NET 2.0 and NUnit 2.4.1, this test fails. It fails from the Assert, not from an exception thrown by Open()! If I run it in the debugger, and manually execute "conn.Open()" in the Immediate Window, it changes the state to Open. However when I step over the executable line itself does not.

I can run a web app under 2.0 and connect using the same connection string, so I am thinking it has something to do with running the code under NUnit and .NET 2.0.

Code: Select all
namespace Inv.Core.DM.User.UnitTests {
[TestFixture] public class SitewideUserTests {
[Test] public void TestCorelab()
{
   using (CoreLab.MySql.MySqlConnection conn = new CoreLab.MySql.MySqlConnection("Data Source=[ipaddr];Database=[db];User ID=[user];Password=[pw]"))
   {
      conn.Open();
      Assert.AreEqual(ConnectionState.Open, conn.State);
   }
} // test method
} // class
} // namespace


Any ideas would be appreciated.
invcmd
 
Posts: 3
Joined: Sat 16 Jun 2007 21:43

Postby Alexey » Mon 18 Jun 2007 08:10

Try to use the following code:
Code: Select all
namespace Inv.Core.DM.User.UnitTests
{
    using System;
    using NUnit.Framework;
    using System.Data;
    [TestFixture]
    public class SitewideUserTests
    {
        [Test]
        public void TestCorelab()
        {
            using (CoreLab.MySql.MySqlConnection conn = new CoreLab.MySql.MySqlConnection("Data Source=[ipaddr];Database=[db];User ID=[user];Password=[pw]"))
            {
                conn.Open();
                Console.WriteLine(typeof(ConnectionState).Assembly.FullName + "\r\n" + ((int)ConnectionState.Open).ToString());
                Console.WriteLine(conn.State.GetType().Assembly.FullName + "\r\n" + ((int)conn.State).ToString());
                Assert.AreEqual(ConnectionState.Open, conn.State);
            }
        } // test method
    } // class
} // namespace

Report your results.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby invcmd » Mon 18 Jun 2007 14:38

The output I get is:
System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
1
System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
0
invcmd
 
Posts: 3
Joined: Sat 16 Jun 2007 21:43

Postby invcmd » Mon 18 Jun 2007 20:29

Additional information:
Code: Select all
Console.WriteLine("{0}\r\n{1}", typeof(MySqlConnection).Assembly.CodeBase, (int)ConnectionState.Open);
Console.WriteLine("{0}\r\n{1}", conn.GetType().Assembly.CodeBase, (int)conn.State);

This results in:
file:///C:/WINDOWS/assembly/GAC/CoreLab.MySql/3.50.13.0__09af7300eec23701/CoreLab.MySql.dll
1
file:///C:/WINDOWS/assembly/GAC/CoreLab.MySql/3.50.13.0__09af7300eec23701/CoreLab.MySql.dll
0

Does that help?
invcmd
 
Posts: 3
Joined: Sat 16 Jun 2007 21:43

Postby Alexey » Tue 19 Jun 2007 07:26

Unfortunately, we cannot reproduce this problem. I've got "1" in both cases. Seemingly, you have some configuration problems.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for MySQL