npgsql / npgsql

Npgsql is the .NET data provider for PostgreSQL.
http://www.npgsql.org
PostgreSQL License
3.3k stars 820 forks source link

open connection on korean windows XP gives error #173

Closed remcobrood closed 10 years ago

remcobrood commented 10 years ago

On korean windows XP machine using npgsql drivier from 2.0.12 and higher I get an The type initializer for 'NpgsqlTypes.NpgsqlTypesHelper' threw an exception error

This only happens on XP machine, windows 7 works fine.

    public string Connect(string server
                          , string port
                          , string user
                          , string password
                          , string database)
    {
        string connectStr =
              "Server=" + server +
              ";Port=" + port +
              ";User Id=" + user +
              ";Password=" + password +
              ";Encoding=UNICODE" +
              ";Timeout=15" +
              ";CommandTimeout=300" +
              ";Database=" + database + ";";

        try
        {
            Wizard.Connection = new NpgsqlConnection(connectStr);
            Wizard.Connection.Open();
        }
        catch (Exception ex)
        {
            return ex.Message;
        }
        return "";
    }
franciscojunior commented 10 years ago

Hi, @remcobrood !

Can you post the stack trace of the error?

remcobrood commented 10 years ago

On 25-2-2014 16:54, Francisco Figueiredo Jr. wrote:

Hi, @remcobrood https://github.com/remcobrood !

Can you post the stack trace of the error?

— Reply to this email directly or view it on GitHub https://github.com/npgsql/Npgsql/issues/173#issuecomment-36022295.

I added a screen shot of the stacktrace. I don't have a full build environment on Korean windows (can't read or write korean)


ir. Remco Brood Knowledge Centre Wind turbine Materials and Constructions

Postal address: Knowledge Centre WMC P.O. Box 43 1770 AA Wieringerwerf The Netherlands

Delivery/visiting address: Kluisgat 5 1771 MV Wieringerwerf

T: +31-227-504937/504949 F: +31-227-504948 E: r.brood@wmc.eu W: www.wmc.eu

The Knowledge Centre WMC is a foundation established by the Energy research Centre of the Netherlands (ECN) and the Delft University of Technology (TUD).


remcobrood commented 10 years ago

If attached png is not loaded here the text Could not connect to server. The type initializer for 'NpgsqlTypes.NpgsqlTypesHelper' threw an exception. at NpgsqlTypes.NpgsqlTypesHelper.CreateAndLoadInitialTypesMapping(NpgsqlConnector conn) at Npgsql.NpgsqlConnector.Open() in C:\projects\Npgsql2\scr\Npgsql\NpgsqlConnector.cs:line 847 at Npgsql.NpgsqlConnectorPool.GetPooledConnector(NpgsqlConnection Connection) in C:\project\Npgsql2\src\Npgsql\NpgsqlConnectorPool.cs:line 447 at Npgsql.NpgsqlConnectorPool.RequestPooldConnectorInternal(NpgsqlConnection Connection) in C:\project\Npgsql2\src\Npgslq\NpgsqlConnectorPool.cs:line 240 at Npgsql.NpgsqlConnectorPool.RequestPooledConnector(NpgsqlConection Connection) in C:\project\Npgsql2\src\Npgslq\NpgsqlConnectorPool.cs:line 202 at Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConection Connection) in C:\project\Npgsql2\src\Npgslq\NpgsqlConnectorPool.cs:line 181 at Npgsql.NpgsqlConnection.Open() in C:\project\Npgsql2\src\Npgsql\NpgsqlConnection.cs:line 543 at CreateDatabase.ConnectionPage.Connect(String server , String port , String user, Sring password, String database) in C:\programs\focus6a\FocusSetup\CreateDatabase\ConnectionPage.cs:line 55

remcobrood commented 10 years ago

Solved:

download and Install the following packages from Microsoft

Microsoft .NET Framework 2.0 Service Pack 2 and Microsoft Visual C++ 2008 Redistributable Package (x86)

franciscojunior commented 10 years ago

Great! I'm glad to hear you got it working.

Thanks for your feedback about that. It will help others who face the same problem.