dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.73k stars 3.17k forks source link

Package Manager Console prompt never returns after running EF Core commands #19021

Closed vsfeedback closed 2 years ago

vsfeedback commented 4 years ago

This issue has been moved from a ticket on Developer Community.


After executing an EF Core command (e.g. Add-Migration), the Package Manager Console prompt never returns. My current workaround is to restart Visual Studio after every command. (As someone new to EF who makes a lot of typos, this is less than ideal.)

I saw a similar report named "Package manager console not exiting after running a command" from July 2019. A responder asked if "dir" or "dotnet" exhibited the same issue, but the reporter never responded and the report was closed. I checked these - both "dir" and "dotnet" return to the prompt successfully.


Original Comments

stefan on 11/19/2019, 03:05 PM:

(This problem isn't appearing in my list of "Following" reports. I'm only able to find it by looking at my Activity feed. Hopefully I get notified on any replies...

Visual Studio Feedback System on 11/19/2019, 10:41 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

stefan on 11/20/2019, 06:55 PM:

Yep, no notification on that comment, I had to remember to come back and find this report in my Activity feed. No wonder every report gets closed due to unanswered questions ☹


Original Solutions

(no solutions)

ajcvickers commented 4 years ago

Which version of EF Core are you using?

StefAnglr commented 4 years ago

Thanks for taking a look at this. We are using EF Core 3.0.1. Here's an example (clumsily sanitized) of the Project Manager Console output:

PM> Add-Migration MigrationName -v
Using project 'EfProjectName'.
Using startup project 'ApiProjectName'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile C:\src\ProjectName\bin\Debug\netcoreapp3.0\ApiProjectName.deps.json --additionalprobingpath C:\Users\stefan\.nuget\packages --additionalprobingpath C:\Microsoft\Xamarin\NuGet --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig C:\src\ProjectName\bin\Debug\netcoreapp3.0\ApiProjectName.runtimeconfig.json C:\Users\stefan\.nuget\packages\microsoft.entityframeworkcore.tools\3.0.1\tools\netcoreapp2.0\any\ef.dll migrations add MigrationName --json --verbose --no-color --prefix-output --assembly C:\src\ProjectName\bin\Debug\netcoreapp3.0\EfProjectName.dll --startup-assembly C:\src\ProjectName\bin\Debug\netcoreapp3.0\ApiProjectName.dll --project-dir C:\src\ProjectNamesrc\EfProjectName\ --language C# --working-dir C:\src\ProjectNamesrc --root-namespace EfProjectName
Using assembly 'EfProjectName'.
Using startup assembly 'ApiProjectName'.
Using application base 'C:\src\ProjectName\bin\Debug\netcoreapp3.0'.
Using working directory 'C:\src\ProjectName'.
Using root namespace 'EfProjectName'.
Using project directory 'C:\src\ProjectNamesrc\EfProjectName\'.
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding application service provider...
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
Using application service provider from Microsoft.Extensions.Hosting.
Found DbContext 'TheDbContext'.
Finding DbContext classes in the project...
Using context 'TheDbContext'.
Microsoft.EntityFrameworkCore.Infrastructure[10403]
      Entity Framework Core 3.0.1 initialized 'TheDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: CommandTimeout=7800 
Finding design-time services for provider 'Microsoft.EntityFrameworkCore.SqlServer'...
Using design-time services from provider 'Microsoft.EntityFrameworkCore.SqlServer'.
Finding design-time services referenced by assembly 'ApiProjectName'.
Using design-time services from assembly 'Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite'.
Finding IDesignTimeServices implementations in assembly 'ApiProjectName'...
No design-time services were found.
Writing migration to 'C:\src\ProjectNamesrc\EfProjectName\Migrations\20191126212008_MigrationName.cs'.
Writing model snapshot to 'C:\src\ProjectNamesrc\EfProjectName\Migrations\TheDbContextModelSnapshot.cs'.

The migration succeeds in this case, but I never get back to the PM> prompt without restarting Visual Studio.

ajcvickers commented 4 years ago

@bricelam I was able to find issues where similar things were reported (#14651, #10699, #15111, #12360), and one that we fixed for 2.1 (#11066).

@StefAnglr Can you post a small project/solution where you see this behavior?

StefAnglr commented 4 years ago

I can't share the solution that is currently causing this for me. I will try to put a repro project together ASAP.

ajcvickers commented 4 years ago

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

StefAnglr commented 4 years ago

For anybody who stumbles onto this in the future, I was able to recover my Package Manager Console prompt by killing a .NET Core Host process that appeared in Task Manager as a subprocess of Visual Studio. No more restarting Visual Studio after every migration attempt!

AlexDenton commented 4 years ago

I seem to be getting this as well. Any updates on this issue?