However, JSON responses occasionally get processed by this code, and can ultimately strip out key-hints (like "certificate is expired") that would be included in the exception's default message.
To Reproduce
Send a request to update a NotificationHubDescription that includes an expired APNS Certificate.
Receive an error message that says simply "BadRequest", doesn't mention the expired certificate.
Other simpler to repro bad-requests may exhibit the same behavior, but are yet to be identified.
Describe the bug After a customer compliant, I briefly inspected our exception handling code in this library. When a client receives a Bad Request (HTTP 400), it will get processed here: https://github.com/Azure/azure-notificationhubs-dotnet/blob/da468dfaaf072f0ef2fd17389f61e504f732edb7/src/Microsoft.Azure.NotificationHubs/ExceptionUtility.cs#L42
which in turn attempts to process it as XML here:
https://github.com/Azure/azure-notificationhubs-dotnet/blob/da468dfaaf072f0ef2fd17389f61e504f732edb7/src/Microsoft.Azure.NotificationHubs/ExceptionUtility.cs#L106
However, JSON responses occasionally get processed by this code, and can ultimately strip out key-hints (like "certificate is expired") that would be included in the exception's default message.
To Reproduce