This is occurring on my .NET Core 2.2 web server.
I'm getting this exception when trying to read anything from a MySql database. I shouldn't be using windows-1252 anywhere, I've verified there's no references in my code, I should be using UTF-8 everywhere. Here is the code that causes the exception:
public async Task<AdminCredentials> Authenticate(string partnerId, string productInstanceId)
{
if (string.IsNullOrEmpty(partnerId) || string.IsNullOrEmpty(productInstanceId))
{
return null;
}
AdminCredentials item = null;
using (var cmd = new MySqlCommand())
{
cmd.CommandText = $@"
SELECT partner_id, product_instance_id
FROM integrations
WHERE partner_id = @partnerId AND product_instance_id = @productInstanceId;";
cmd.Parameters.AddWithValue("@partnerId", partnerId);
cmd.Parameters.AddWithValue("@productInstanceId", productInstanceId);
using (var reader = await _db.ExecuteReaderAsync(cmd))
Happens on using (var reader = await _db.ExecuteReaderAsync(cmd))
. The full exception message is:
Exception has occurred: CLR/System.ArgumentException
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll: ''windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.'
at System.Text.EncodingTable.internalGetCodePageFromName(String name)
I've done a ton of digging but no luck so far. This is happening with every read request of the database, not just this one. The database is utf-8 encoded as well.
Everything seems to work fine from a front-end users perspective. Just this exception occurring literally every time.