private TMessage GetTypedMessage(QueueMessage message) { if (typeof(TMessage) == typeof(string)) { return((TMessage)Convert.ChangeType(message.GetMessageText(_workerOptions.Base64Decode), typeof(TMessage), CultureInfo.InvariantCulture)); } if (typeof(TMessage) == typeof(QueueMessage)) { return((TMessage)Convert.ChangeType(message, typeof(TMessage), CultureInfo.InvariantCulture)); } return(JsonSerializer.Deserialize <TMessage>( message.GetMessageText(_workerOptions.Base64Decode), new JsonSerializerOptions { PropertyNameCaseInsensitive = true, AllowTrailingCommas = true, ReadCommentHandling = JsonCommentHandling.Skip })); }