RuntimeBinderException: The best overloaded method match for 'Microsoft.AspNetCore.DataProtection.IDataProtector.Protect(byte[])' has some invalid arguments
Solution: This error happens when you passed in dynamic IList content. The compilation might pass but the runtime might have errors passing the code.
- In order to resolve this issue, extract the content you want to protect into a separate variable then pass that variable into a Protect() function.
- If you haven't registered the Service you might get an error that says: InvalidOperationException: No service for type 'Microsoft.AspNetCore.DataProtection.IDataProtector' has been registered.
This is because you can not inject an IDataProtector in the View, the way you use DataProtection is by Protecting and then Unprotecting the variable in the same function that protected it.