I use AuthorizeAsync() is a .NET 6 project. My Visual Studio version is 17.10.3 and I do not have this problem.
The error message indicate the string "System.Object[]" was passed to the policyName parameter.
InvalidOperationException: No policy found: System.Object[].
The error message also shows line106 in your source code where the variable passed to the string policyName parameter is policy.ToString(). I'm guessing that the "policy" variable is defined as a "var". The code populating the policy variable is probably populating policy with an object array because when an array of objects is converted to a string the result is "System.Object[]".
var policy = new object[] { "one", "two" };
Console.WriteLine(policy.ToString());
If "System.Object[]" is passed to policyName parameter then you get the the error message in your screenshot.
Could you please advise on what might be causing this issue and how we can resolve it?
I have to guess because the only source code provided is in the error message which is a screenshot. Find where "policy" is defined. Make sure policy is defined as a string not a var or something else. Once this change is made then you'll probably see a complier error in Visual Studio because whatever is populating policy needs to be updated as well.
Also, remove the .ToString() from policy.ToString() in line 106.
Lastly, Visual Studio has a wonderful debugger. Set a breakpoint on line 106 and use the debugger's locals or watch window to view the actual value of "policy"
https://video2.skills-academy.com/en-us/visualstudio/debugger/debugger-feature-tour?view=vs-2022