简体   繁体   English

do.net ef 核心列表永远不会完成

[英]dotnet ef core list never completes

After submitting a build though Azure Dev Ops, we noticed that the command to build the migration steps timed out after an hour of inactivity.通过 Azure Dev Ops 提交构建后,我们注意到构建迁移步骤的命令在闲置一小时后超时。 It only happened on this branch and we've completed others before and since successfully.它只发生在这个分支上,我们已经成功地完成了其他分支。 The solution builds and runs successfully.该解决方案成功构建并运行。

Upon investigating, I narrowed down the issue to happening on the following command:经过调查,我将问题缩小到在以下命令中发生:

dotnet ef migrations list --configuration Release --project <repo_project_name> --startup-project <startup_project_name> --no-build --context <fully_qualified_context_class_name>

When I run the above command in Powershell,it after spitting out the list of migrations in the project, it just hangs and never returns to a prompt.当我在 Powershell 中运行上面的命令时,它在吐出项目中的迁移列表后,它只是挂起并且永远不会返回到提示符。

I've seen other discussions of similar issues suggesting to delete the obj folder, but when I do that in the startup project folder, I get a message that it's missing the project.assets.json.我已经看到其他关于建议删除 obj 文件夹的类似问题的讨论,但是当我在启动项目文件夹中执行此操作时,我收到一条消息,提示它缺少 project.assets.json。 (When I do it in the repo project folder, it hangs as before. But even if that did resolve it locally, how could I implement that on the ADO server? (当我在 repo 项目文件夹中执行它时,它像以前一样挂起。但即使在本地解决了它,我如何在 ADO 服务器上实现它?

To make matters weirder, this particular branch didn't even update the repo project.更奇怪的是,这个特定的分支甚至没有更新 repo 项目。

Any thoughts as to how I should proceed?关于我应该如何进行的任何想法? Thanks.谢谢。

UPDATE: I've been able to narrow down that we're waiting for a thread to end.更新:我已经能够缩小我们正在等待线程结束的范围。 This is the call stack at the point where it's hanging:这是它挂起时的调用堆栈:

System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOneNoCheck(int millisecondsTimeout)
System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout)
System.Diagnostics.Process.dll!System.Diagnostics.Process.WaitForExitCore(int milliseconds)
dotnet-ef.dll!Microsoft.EntityFrameworkCore.Tools.Exe.Run(string executable, System.Collections.Generic.IReadOnlyList<string> args, string workingDirectory, bool interceptOutput)
dotnet-ef.dll!Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute()
dotnet-ef.dll!Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.Configure.AnonymousMethod__0()
dotnet-ef.dll!Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(string[] args)
dotnet-ef.dll!Microsoft.EntityFrameworkCore.Tools.Program.Main(string[] args)

The issue turned out to be a process we developed was not shutting down properly after script generation.问题原来是我们开发的进程在脚本生成后没有正确关闭。 The reason for that seems to be that "do.net ef migrations" only does a partial startup of the website.这样做的原因似乎是“do.net ef migrations”只对网站进行了部分启动。 It calls Startup.ConfigureServices but not Startup.Configure, which is where web shutdown functions are configured, so I'm theorizing that Dispose methods don't get called properly, resulting in our process not shutting down correctly.它调用 Startup.ConfigureServices 但不调用 Startup.Configure,这是配置 web 关闭函数的地方,所以我推测 Dispose 方法没有被正确调用,导致我们的进程没有正确关闭。

I worked around that by implementing the suggestion found in this answer to another question.我通过实施另一个问题的答案中的建议来解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM