ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.17k stars 297 forks source link

Reverse Engineer and Postgre throw exception #200

Closed Alan-Lun closed 5 years ago

Alan-Lun commented 5 years ago

Describe what is not working as expected.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue. 1.EF core Power Tools

  1. Reverse Engineer
  2. add
  3. connect postgre
  4. test connect
  5. throw Exception Could not load file or assembly 'System.Memory, Version=4.0.1.0,Culture=neutral, ...' or one of its dependencies. 系統找不到指定的檔案

Further technical details

EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu) 2.2.12

Database engine: (SQlite, SQL Compact, SQL Server, Postgres) Postgres

Visual Studio version: (e.g. Visual Studio 2017 15.7) Visual Studio 2017 15.9.10

ErikEJ commented 5 years ago

@roji - any ideas?

ErikEJ commented 5 years ago

Using Npgsql 4.0.4

roji commented 5 years ago

This seems like https://github.com/npgsql/npgsql/issues/2356 - can you please try the recently-released 4.0.6 and confirm?

Alan-Lun commented 5 years ago

https://imgur.com/a/pGiWbMw https://imgur.com/a/hRJoqF2 https://imgur.com/a/lOBNAH3

TestConnect throw exception

ErikEJ commented 5 years ago

@Alan-Lun I need to update in EF Core Power Tools, updaing in your project does not make any difference

roji commented 5 years ago

(@ErikEJ let me know who it works out - if there's still an issue we'll fix it)

ErikEJ commented 5 years ago

@Alan-Lun Attempted a fix in the latest daily build, please try it out and let mw know.

Alan-Lun commented 5 years ago

https://imgur.com/a/Vp7iiGK https://imgur.com/OknGhWz

Yes, but still the same error.

ErikEJ commented 5 years ago

@roji ??

ErikEJ commented 5 years ago

I run in VS process, and require .net 4.7.1

Alan-Lun commented 5 years ago

I installed .net framework 4.8 And run .net core 2.2

https://imgur.com/a/6S5Yz4X https://imgur.com/Dw9Z1pE

polanfong commented 5 years ago

I had the same issue. Full stack trace is:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. File name: 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' at Npgsql.NpgsqlWriteBuffer.WriteBytes(Byte[] buf, Int32 offset, Int32 count) at Npgsql.FrontendMessages.PregeneratedMessage.WriteFully(NpgsqlWriteBuffer buf) at Npgsql.SimpleFrontendMessage.Write(NpgsqlWriteBuffer buf, Boolean async) at Npgsql.NpgsqlConnector.PrependInternalMessage(FrontendMessage msg) at Npgsql.NpgsqlConnector.Reset() at Npgsql.ConnectorPool.Release(NpgsqlConnector connector) at Npgsql.NpgsqlConnection.Close(Boolean wasBroken) at Npgsql.NpgsqlConnection.Close() at Npgsql.NpgsqlConnection.Dispose(Boolean disposing) at System.ComponentModel.Component.Dispose() at ErikEJ.SqlCeToolbox.Helpers.EnvDteHelper.GetNpgsqlTableNames(String connectionString) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Helpers\EnvDTEHelper.cs:line 183 at EFCorePowerTools.Handlers.ReverseEngineerHandler.GetTablesFromRepository(DatabaseInfo dbInfo) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 269 at EFCorePowerTools.Handlers.ReverseEngineerHandler.<ReverseEngineerCodeFirst>d__2.MoveNext() in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 111

I had npgsql v4.0.3 installed in the GAC (via the msi installer). I've since uninstalled that and ran Npgsql-4.0.6.msi. Seems to be all good now.

roji commented 5 years ago

@ErikEJ sorry for not looking sooner... So you're saying that the MSI installer for Npgsql 4.0.6 still does not install System.Memory into the GAC? I will try to look at this in the coming days (please ping me in a week if still no response).

ErikEJ commented 5 years ago

@roji Thanks, but no - I simply use the ADO.NET Nuget package

roji commented 5 years ago

@ErikEJ in that case, do you think there's an issue with Npgsql? Npgsql 4.0.6 depends on System.Memory 4.5.2, are you seeing any issue there?

ErikEJ commented 5 years ago

I am not seeing any issue, as I do not have Postgres available.

attiqeurrehman commented 5 years ago

@ErikEJ I am having a similar issue where after testing the connection with ODBC and pressing Ok it's not shown in the Choose Database Connection.

ErikEJ commented 5 years ago

ODBC is not supported, you must use the VS native postgres tooling

attiqeurrehman commented 5 years ago

Sorry for being a nuisance, but can you please explain what do you mean by VS native postgres tooling ?

ErikEJ commented 5 years ago

I mean https://www.npgsql.org/doc/ddex.html

attiqeurrehman commented 5 years ago

Got it thanks.

kurddt commented 5 years ago

I had the same issue. I was running version 4.0.6 of the vsix and nugget package fine =>after a few windows update and VS restart I got the same exception.

The only way to resolve this as pointed out by @polanfong was to install the nspql msi. I don't thing installing the msi was required before

ErikEJ commented 5 years ago

Installing the MSI for Npgsql has always been a requirement

roji commented 5 years ago

FYI for everyone involved, at as I'm aware there's no issue on the Npgsql side - please let me know if you still run into problems after installing the latest version of the MSI.

Alan-Lun commented 5 years ago

I still have errors. https://imgur.com/a/tpFSJmN https://imgur.com/5nualMs

Alan-Lun commented 5 years ago

Is there 4.0.7 to test?... thank you

roji commented 5 years ago

Just looked into this again, and the dependency on System.Memory was indeed missing - but from the VSIX and not from the MSI.

@ErikEJ the MSI is not supposed to be required - installing the VSIX alone should be sufficient. The VSIX brings its own dependencies into the extension and is not supposed to rely on the GAC.

roji commented 5 years ago

I will be releasing 4.0.7 in the next few hours with this fix.

ErikEJ commented 5 years ago

Thanks for taking time to fix @roji

Alan-Lun commented 5 years ago

Good ! Thank you