If you're migrating, you might want to move to something that will be supported for more than two months:
.NET and .NET Core official support policy[^]:
.NET Core 3.1 End of Support: December 13, 2022
Currently, the "long-term support" (LTS) version is .NET 6.0, which is supported until at least November 12, 2024. Also, you forgot to explain what the problem is with your code. There's nothing obviously wrong with it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer