In my case, using different versions of Microsoft.Extensions.AI package across different projects was the issue so all I had to do was to make sure that all nuget packages across different packages are on the same version.