Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Error trying to create model from database #2246

Closed
JulianoAlexandre opened this issue Mar 27, 2024 · 10 comments
Closed

[Bug] Error trying to create model from database #2246

JulianoAlexandre opened this issue Mar 27, 2024 · 10 comments
Labels
bug Something isn't working reveng

Comments

@JulianoAlexandre
Copy link

I update the extension with the version 2.6.199, now when I try create EF Core DbContext from my database project, I am receiving this error message: "System.NullReferenceException: Object reference not set to an instance of an object.
at async Task<List> EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.GetTablesAsync(DatabaseConnectionModel dbInfo, CodeGenerationMode codeGenerationMode, SchemaInfo[] schemas)
at async Task EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.LoadDataBaseObjectsAsync(ReverseEngineerOptions options, DatabaseConnectionModel dbInfo, Tuple<List, string> namingOptionsAndPath) x 2
at async Task EFCorePowerTools.Handlers.ReverseEngineer.ReverseEngineerHandler.ReverseEngineerCodeFirstAsync(Project project, string optionsPath, bool onlyGenerate, bool fromSqlProj)"

Simple tables are in my db project, any try to create it generate the error.

My Visual Studio 2022 17.9.5
Database engine: Azure SQL
EF Core version 8.0.2
Is Handlebars templates used: no
Is T4 templates used: no
Is a SQL Server .dacpac: yes

@JulianoAlexandre JulianoAlexandre changed the title Error in version 2.6.199 to create model from database. [Bug] Error trying to create model from database Mar 27, 2024
@ErikEJ
Copy link
Owner

ErikEJ commented Mar 27, 2024

Can you share the .dacpac ? (privately)

@JulianoAlexandre
Copy link
Author

Can you share the .dacpac ? (privately)

Yes, should I forward it to your email address?

@ErikEJ
Copy link
Owner

ErikEJ commented Mar 27, 2024

@JulianoAlexandre Yes, you can do that

@JulianoAlexandre
Copy link
Author

Any database project that contains only one table is enough to generate this error message when creating an EF Core DbContext. A workaround is to navigate to efpt.config.json, right-click, select 'EF Core Power Tools - Edit,' and a popup screen will appear.
image
image

@ErikEJ
Copy link
Owner

ErikEJ commented Mar 27, 2024

@JulianoAlexandre Could you PLEASE explain how to trigger the error then (not how to work around it) - I do not understand the circumstances.

@JulianoAlexandre
Copy link
Author

JulianoAlexandre commented Mar 27, 2024

@JulianoAlexandre Could you PLEASE explain how to trigger the error then (not how to work around it) - I do not understand the circumstances.

After right click in the Database1 project, selecting "Create EF Core DbContext...", I choose the project, in this case, "ClassLibrary1". It directly creates the efpt.config.json file with default values, without showing me the popup to select the tables and parameters I need. The error I mentioned is shown here, in the Extensions. Can you understand the steps I took for this to happen?

image
image
image
image

@ErikEJ
Copy link
Owner

ErikEJ commented Mar 27, 2024

@JulianoAlexandre Yes,I can now. Will investigate

@ErikEJ ErikEJ added question Further information is requested bug Something isn't working reveng and removed question Further information is requested labels Mar 27, 2024
@ErikEJ ErikEJ closed this as completed in 5c5a124 Mar 28, 2024
@ErikEJ
Copy link
Owner

ErikEJ commented Mar 28, 2024

I was not able to repro your exact issue, butI implemented a fix for some related issues in the latest daily build, would be grateful if you could try it out.

@JulianoAlexandre
Copy link
Author

I was not able to repro your exact issue, butI implemented a fix for some related issues in the latest daily build, would be grateful if you could try it out.

Hi Erik, thank you, everything is working fine with the 2.6.200 version. :)

@ErikEJ
Copy link
Owner

ErikEJ commented Mar 28, 2024

Thanks for confirming- I will Update the MarketPlace version with this Bug fix soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reveng
Projects
None yet
Development

No branches or pull requests

2 participants