this is my code

public void Select()
{
    using (NpgsqlConnection con = new NpgsqlConnection(connectionString))
    {
        con.Open();
        //...other code
    }
}

When this program reaches “con. Open()”, the program reports System TypeInitializationException: Error in ‘NpgSQL. TypeMapping. GlobalTypeMapper’,What I am doing is secondary development of BimBase. When I use a new. net framework program, it can run, but when I enter the command from BimBase, it will report this error

  1. I have tried to adjust the version of NpgSQL.dll, but neither 4.1.7 nor 4.1.12 worked
  2. I have loaded the dependencies according to Nuget’s instructions, but it still doesn’t work
  3. I have already configuredin app. config, but this cannot solve the problem either

New contributor

Leonard before Connor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.