Bug #56410 Assembly.Load ("Mono.Posix") fails

Submitted: 31 Aug 2010 15:25 Modified: 12 Nov 2010 15:14
Reporter: Gonzalo Paniagua Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:2.6.4 OS:Linux
Assigned to: Reggie Burnett CPU Architecture:Any

[31 Aug 2010 15:25] Gonzalo Paniagua
Description:
The 2.6.4 connector download for .NET/Mono tries to dynamically load the Mono.Posix.dll assembly when a unix socket is used to connect to the server. This fails and the connector cannot use a unix socket unless the Mono.Posix.dll assembly is previously loaded by the program.

How to repeat:
Compile the following program in linux with gmcs (Mono's C# compiler) and run it:
-----------------------------------------------
using System;
using MySql.Data.MySqlClient;

namespace test
{
  class MainClass
  {
    public static void Main (string[] args)
    {
      string connString = "Server=/var/run/mysqld/mysqld.sock; Database=INSERT_SCHEMA_HERE; User ID=INSERT_USERNAME_HERE; Password=INSERT_PASSWORD_HERE; Protocol=unix;";
      MySqlDataReader reader = MySqlHelper.ExecuteReader(connString, "SHOW TABLES");

      while (reader.Read())
      {
        Console.WriteLine(reader[0]);
      }
    }
  }
}
------------------------

Expected result: the output of SHOW TABLES

Actual results: 
System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Posix' or one of its dependencies. The system cannot find the file specified.

Suggested fix:
The problem is that the connector is using something like:

    Assembly x = Assembly.Load ("Mono.Posix");

which fails (Assembly.LoadWithPartialName () would work, but is obsoleted), instead of:

    Assembly x = Assembly.Load ("Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");

Note: "Mono.Posix, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" and "Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" would also work just fine.
[16 Oct 2010 21:38] Robert Hollencamp
Tested against 6.3.4, no dice - problem still exists
[9 Nov 2010 20:31] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/123331

845 Reggie Burnett	2010-11-09
      - fixed loading of mono.posix assembly to use the right assembly (bug #56410)
[9 Nov 2010 20:36] Reggie Burnett
fixed in 6.0.8, 6.1.6, 6.2.5, 6.3.6+
[12 Nov 2010 15:14] Tony Bedford
An entry has been added to the 6.0.8, 6.1.6, 6.2.5, 6.3.6 changelogs:

MySQL Connector/NET for .NET/Mono attempted to dynamically load the assembly Mono.Posix.dll when a Unix socket was used to connect to the server. This failed and the connector was not able to use a Unix socket unless the Mono.Posix.dll assembly was previously loaded by the program.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.