I installed this Microsoft.Extensions.Configuration.Binder package and the problem solved.
The strange thing is that when I was using .net-core3.1
I did not need to install it from Nuget
but after updating to .net5
I needed to install this package separately.