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

dbcontext scaffold falsely states: "Missing required argument '<PROVIDER>'." #24251

Closed
rbenjes opened this issue Feb 24, 2021 · 15 comments · Fixed by #24345
Closed

dbcontext scaffold falsely states: "Missing required argument '<PROVIDER>'." #24251

rbenjes opened this issue Feb 24, 2021 · 15 comments · Fixed by #24345
Assignees
Labels
area-scaffolding closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@rbenjes
Copy link

rbenjes commented Feb 24, 2021

Entity Framework Core .NET Command-line Tools 6.0.0-preview.1.21102.2

Calling

dotnet ef dbcontext scaffold "context" provider

results in error message

Missing required argument '<PROVIDER>'.

Obviously that is not the case.

This behavior did not occur in the previous version (5.0.?).

Output with option --verbose:
dotnet exec --depsfile D:\Source\Workspaces\Test\DbNQCore\DbNQCore\bin\Debug\net5.0\DbNQCore.deps.json --additionalprobingpath C:\Users\rbenjes\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" C:\Users\rbenjes\.dotnet\tools\.store\dotnet-ef\6.0.0-preview.1.21102.2\dotnet-ef\6.0.0-preview.1.21102.2\tools\netcoreapp3.1\any\tools\netcoreapp2.0\any\ef.dll dbcontext scaffold connection Microsoft.EntityFrameworkCore.SqlServer --assembly D:\Source\Workspaces\Test\DbNQCore\DbNQCore\bin\Debug\net5.0\DbNQCore.dll --startup-assembly D:\Source\Workspaces\Test\DbNQCore\DbNQCore\bin\Debug\net5.0\DbNQCore.dll --project-dir D:\Source\Workspaces\Test\DbNQCore\DbNQCore\ --language C# --working-dir D:\Source\Workspaces\Test\DbNQCore\DbNQCore --verbose --root-namespace DbNQCore Microsoft.EntityFrameworkCore.Tools.CommandException: Missing required argument '<PROVIDER>'. at Microsoft.EntityFrameworkCore.Tools.Commands.DbContextScaffoldCommand.Validate() at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args) at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) Missing required argument '<PROVIDER>'.

@ajcvickers
Copy link
Member

@bricelam I am able to reproduce this. Looks like .NET 6 is breaking the dotnet-ef tool.

@bricelam
Copy link
Contributor

dotnet exec ...\ef.dll dbcontext scaffold connection Microsoft.EntityFrameworkCore.SqlServer

Weird stuff. The first three arguments are definitely getting parsed... I'll need to debug to fully understand what's going on.

@bricelam
Copy link
Contributor

/cc @dsplaisted (in case this rings a bell...)

@dsplaisted
Copy link
Member

We switched to a new command line parser for .NET 6 so that's likely related.

@sfoslund Can you look at this?

@sfoslund
Copy link
Member

I'm not able to repro this issue with 6.0.100-preview.2.21120.3 and dotnet-ef version 5.0.3, it's possible that it was fixed by one of the changes that didn't make it into preview 1. @ajcvickers were you also reproducing with preview 1?

@ajcvickers
Copy link
Member

@sfoslund Yes, I also used preview 1.

@sfoslund
Copy link
Member

Great, unless anyone can repro this with preview 2 it can probably be closed as fixed.

@ajcvickers
Copy link
Member

@sfoslund Thanks. We will verifiy with preview 2.

@AndriySvyryd AndriySvyryd added this to the 6.0.0 milestone Mar 1, 2021
@AndriySvyryd AndriySvyryd added the verify-fixed This issue is likely fixed in new query pipeline. label Mar 1, 2021
@bricelam
Copy link
Contributor

bricelam commented Mar 8, 2021

It's not related to the recent SDK changes. This was caused by some bad code cleanup in PR #22625.

bricelam added a commit to bricelam/efcore that referenced this issue Mar 8, 2021
An update to dispose all the things in PR dotnet#22625 accidentally broke our argument parsing logic. This updates that change to preserve the original logic.

Fixes dotnet#24251
@bricelam bricelam added type-bug closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed verify-fixed This issue is likely fixed in new query pipeline. labels Mar 8, 2021
bricelam added a commit to bricelam/efcore that referenced this issue Mar 8, 2021
An update to dispose all the things in PR dotnet#22625 accidentally broke our argument parsing logic. This updates that change to preserve the original logic.

Fixes dotnet#24251
@bricelam bricelam modified the milestones: 6.0.0, 6.0.0-preview3 Mar 9, 2021
@IvanFarkas
Copy link

Yeah. Preview 2 still does this. We'll wait for the next one patently ;-)

@ajcvickers
Copy link
Member

@IvanFarkas I suspect going back to the 5.0 tool will work. The tool itself is a thin wrapper and is designed to be as forward compatible as possible.

@ooples
Copy link

ooples commented Mar 19, 2021

I'm getting this error with preview 2 so I can confirm that the error is still happening. I'm using the package manager console through Visual Studio

@ooples
Copy link

ooples commented Mar 20, 2021

I tried going back to 5.0 and for some reason it still gave me the same error for the package manager console but it worked for the command line interface

@vijaylaxmi13
Copy link

I tried going back to 5.0 and for some reason it still gave me the same error for the package manager console but it worked for the command line interface

Please install the 5.0.0 version and close the visual studio and re-open
then run the command from package manager console.
This worked for me.

@sanjusjk
Copy link

I too faced the same issue with .Net 5.0, Please make sure below are done.

  1. Make Sure the Project which has EF core reference is set as Start up project. In my case, I have a .Net core class library with EF core installed.
  2. try the scaffolding in below format. remove User ID and Password if using Windows auth mode.

scaffold-dbcontext -provider Microsoft.EntityFrameworkCore.SqlServer -connection "Server=(localdb)\MSSQLLocalDB;Database=EFCoreMigration;Trusted_Connection=True;user id=test;password=test;” -OutputDir Models

This worked for me, pleased let me know the feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-scaffolding closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants