Search code examples
asp.netpostgresqlasp.net-corevisual-studio-2022ef-power-tools

The type initializer for 'Npgsql.TypeMapping.BuiltInTypeHandlerResolver' threw an exception, Unable to load entity from database using powertools


I'm using ASP.NET zero and Power tools to load entity from database (PostgreSQL), but it is showing an exception shown in the screenshot(Click the link below):

https://i.sstatic.net/1FXoFb3L.png

My connection string looks like, User ID=username;Password=password;Host=localhost;Port=5432;Database=Postgres;Pooling=true;

Error message: Connection failed! Details: The type initializer for 'Npgsql.TypeMapping.BuiltInTypeHandlerResolver' threw an exception

This error appears when trying to test connection using Asp.net Zero Power Tools for PostgreSQL

Can you please help me solve it?

I searched all sites as possible but it is showing like check version of both Visual Studio (I'm using 2022 version) and Power Tools (I'm using 4.2.1) have not resolved the problem, and I'm expecting to solve this.


Solution

  • The error for connecting to postgre sql using power tools will be resolved in next version of Asp.net zero power tools(Current version is 4.2.1). It is solved in Power tools version(4.3.0).