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:
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
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())

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=, Culture=neutral, PublicKeyToken=0738eb9f132ed756");

Note: "Mono.Posix, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" and "Mono.Posix, Version=, 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:


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.