Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Error connecting Postgres to PowerBI desktop

Hi,

 

I am trying to connect my PowerBI desktop app to Postgres database and I am getting the following error:

An error happened while reading data from the provider: Could not load file or assembly "System.Runtime.CompilerServices.Unsafe. Version 4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

 

image (1).png

 

 

 

1 ACCEPTED SOLUTION
mohitkumawat
Super User
Super User

Hi,

Please try and check the below things 

1) Install latest gateway (if not already installed)

2) Install PostgreSQL driver

3) Create a data source for PostgreSQL in gateway

4) Map data source to Dataset in the dataset settings page
In short, you have to install latest  version of NpgSQL and when installing, select the NpgSQL GAC option. The article I linked has a more detailed step-by-step guide.
https://powerbipoint.com/2024/01/22/fix-power-bi-refresh-error-could-not-load-file-or-assembly-or-on...

View solution in original post

1 REPLY 1
mohitkumawat
Super User
Super User

Hi,

Please try and check the below things 

1) Install latest gateway (if not already installed)

2) Install PostgreSQL driver

3) Create a data source for PostgreSQL in gateway

4) Map data source to Dataset in the dataset settings page
In short, you have to install latest  version of NpgSQL and when installing, select the NpgSQL GAC option. The article I linked has a more detailed step-by-step guide.
https://powerbipoint.com/2024/01/22/fix-power-bi-refresh-error-could-not-load-file-or-assembly-or-on...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors