diff --git a/Samples/azure-storage/Azure.CSharp/IStorageManagementClient.cs b/Samples/azure-storage/Azure.CSharp/IStorageManagementClient.cs
index c0796581ab..5180b72ddc 100644
--- a/Samples/azure-storage/Azure.CSharp/IStorageManagementClient.cs
+++ b/Samples/azure-storage/Azure.CSharp/IStorageManagementClient.cs
@@ -19,12 +19,12 @@ public partial interface IStorageManagementClient : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/Samples/azure-storage/Azure.CSharp/Models/AccountStatus.cs b/Samples/azure-storage/Azure.CSharp/Models/AccountStatus.cs
index ced995a745..90f4b2210b 100644
--- a/Samples/azure-storage/Azure.CSharp/Models/AccountStatus.cs
+++ b/Samples/azure-storage/Azure.CSharp/Models/AccountStatus.cs
@@ -9,7 +9,7 @@ namespace Petstore.Models
///
/// Defines values for AccountStatus.
///
- [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public enum AccountStatus
{
[EnumMember(Value = "Available")]
diff --git a/Samples/azure-storage/Azure.CSharp/Models/AccountType.cs b/Samples/azure-storage/Azure.CSharp/Models/AccountType.cs
index 391efbb94f..b101fbf754 100644
--- a/Samples/azure-storage/Azure.CSharp/Models/AccountType.cs
+++ b/Samples/azure-storage/Azure.CSharp/Models/AccountType.cs
@@ -9,7 +9,7 @@ namespace Petstore.Models
///
/// Defines values for AccountType.
///
- [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public enum AccountType
{
[EnumMember(Value = "Standard_LRS")]
diff --git a/Samples/azure-storage/Azure.CSharp/Models/ProvisioningState.cs b/Samples/azure-storage/Azure.CSharp/Models/ProvisioningState.cs
index d973b58255..60ad099f90 100644
--- a/Samples/azure-storage/Azure.CSharp/Models/ProvisioningState.cs
+++ b/Samples/azure-storage/Azure.CSharp/Models/ProvisioningState.cs
@@ -9,7 +9,7 @@ namespace Petstore.Models
///
/// Defines values for ProvisioningState.
///
- [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public enum ProvisioningState
{
[EnumMember(Value = "Creating")]
diff --git a/Samples/azure-storage/Azure.CSharp/Models/Reason.cs b/Samples/azure-storage/Azure.CSharp/Models/Reason.cs
index b944649230..680b08914d 100644
--- a/Samples/azure-storage/Azure.CSharp/Models/Reason.cs
+++ b/Samples/azure-storage/Azure.CSharp/Models/Reason.cs
@@ -9,7 +9,7 @@ namespace Petstore.Models
///
/// Defines values for Reason.
///
- [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public enum Reason
{
[EnumMember(Value = "AccountNameInvalid")]
diff --git a/Samples/azure-storage/Azure.CSharp/Models/UsageUnit.cs b/Samples/azure-storage/Azure.CSharp/Models/UsageUnit.cs
index f7e2402fd3..d51dd6202f 100644
--- a/Samples/azure-storage/Azure.CSharp/Models/UsageUnit.cs
+++ b/Samples/azure-storage/Azure.CSharp/Models/UsageUnit.cs
@@ -9,7 +9,7 @@ namespace Petstore.Models
///
/// Defines values for UsageUnit.
///
- [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
+ [JsonConverter(typeof(StringEnumConverter))]
public enum UsageUnit
{
[EnumMember(Value = "Count")]
diff --git a/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs b/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs
index 043ab31b3f..19d5fc0e57 100644
--- a/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs
+++ b/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs
@@ -130,6 +130,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -183,7 +185,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -220,7 +222,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -371,6 +373,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -554,6 +558,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -601,7 +607,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -638,7 +644,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -781,6 +787,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -834,7 +842,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -871,7 +879,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -992,6 +1000,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1039,7 +1049,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1076,7 +1086,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1169,6 +1179,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1216,7 +1228,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1253,7 +1265,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1356,6 +1368,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1403,7 +1417,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1440,7 +1454,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1576,6 +1590,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1629,7 +1645,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1666,7 +1682,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1805,6 +1821,8 @@ internal StorageAccountsOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1858,7 +1876,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1895,7 +1913,7 @@ internal StorageAccountsOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/Samples/azure-storage/Azure.CSharp/StorageManagementClient.cs b/Samples/azure-storage/Azure.CSharp/StorageManagementClient.cs
index d16cb0caa0..878063bdf9 100644
--- a/Samples/azure-storage/Azure.CSharp/StorageManagementClient.cs
+++ b/Samples/azure-storage/Azure.CSharp/StorageManagementClient.cs
@@ -25,12 +25,12 @@ public partial class StorageManagementClient : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -284,27 +284,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/Samples/azure-storage/Azure.CSharp/UsageOperations.cs b/Samples/azure-storage/Azure.CSharp/UsageOperations.cs
index 4feb31e6d5..56d806e8c7 100644
--- a/Samples/azure-storage/Azure.CSharp/UsageOperations.cs
+++ b/Samples/azure-storage/Azure.CSharp/UsageOperations.cs
@@ -117,6 +117,8 @@ internal UsageOperations(StorageManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -164,7 +166,7 @@ internal UsageOperations(StorageManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -201,7 +203,7 @@ internal UsageOperations(StorageManagementClient client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/Samples/petstore/CSharp/ISwaggerPetstore.cs b/Samples/petstore/CSharp/ISwaggerPetstore.cs
index 479c9cb311..69f3591ac4 100644
--- a/Samples/petstore/CSharp/ISwaggerPetstore.cs
+++ b/Samples/petstore/CSharp/ISwaggerPetstore.cs
@@ -27,12 +27,12 @@ public partial interface ISwaggerPetstore : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
diff --git a/Samples/petstore/CSharp/Models/Category.cs b/Samples/petstore/CSharp/Models/Category.cs
index d202e6b8d1..1633b5e8d8 100644
--- a/Samples/petstore/CSharp/Models/Category.cs
+++ b/Samples/petstore/CSharp/Models/Category.cs
@@ -3,6 +3,8 @@ namespace Petstore.Models
{
using Newtonsoft.Json;
using System.Linq;
+ using System.Xml;
+ using System.Xml.Linq;
public partial class Category
{
@@ -30,6 +32,46 @@ public Category() { }
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
+ ///
+ /// Serializes the object to an XML node
+ ///
+ internal XElement XmlSerialize(XElement result)
+ {
+ if( null != Id )
+ {
+ result.Add(new XElement("id", Id) );
+ }
+ if( null != Name )
+ {
+ result.Add(new XElement("name", Name) );
+ }
+ return result;
+ }
+ ///
+ /// Deserializes an XML node to an instance of Category
+ ///
+ internal static Category XmlDeserialize(string payload)
+ {
+ // deserialize to xml and use the overload to do the work
+ return XmlDeserialize( XElement.Parse( payload ) );
+ }
+ internal static Category XmlDeserialize(XElement payload)
+ {
+ var result = new Category();
+ var deserializeId = XmlSerialization.ToDeserializer(e => (long?)e);
+ long? resultId;
+ if (deserializeId(payload, "id", out resultId))
+ {
+ result.Id = resultId;
+ }
+ var deserializeName = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultName;
+ if (deserializeName(payload, "name", out resultName))
+ {
+ result.Name = resultName;
+ }
+ return result;
+ }
}
}
diff --git a/Samples/petstore/CSharp/Models/Order.cs b/Samples/petstore/CSharp/Models/Order.cs
index 130e7d5c5a..f9314e8346 100644
--- a/Samples/petstore/CSharp/Models/Order.cs
+++ b/Samples/petstore/CSharp/Models/Order.cs
@@ -3,6 +3,8 @@ namespace Petstore.Models
{
using Newtonsoft.Json;
using System.Linq;
+ using System.Xml;
+ using System.Xml.Linq;
public partial class Order
{
@@ -58,6 +60,86 @@ public Order() { }
[JsonProperty(PropertyName = "complete")]
public bool? Complete { get; set; }
+ ///
+ /// Serializes the object to an XML node
+ ///
+ internal XElement XmlSerialize(XElement result)
+ {
+ if( null != Id )
+ {
+ result.Add(new XElement("id", Id) );
+ }
+ if( null != PetId )
+ {
+ result.Add(new XElement("petId", PetId) );
+ }
+ if( null != Quantity )
+ {
+ result.Add(new XElement("quantity", Quantity) );
+ }
+ if( null != ShipDate )
+ {
+ result.Add(new XElement("shipDate", ShipDate) );
+ }
+ if( null != Status )
+ {
+ result.Add(new XElement("status", Status) );
+ }
+ if( null != Complete )
+ {
+ result.Add(new XElement("complete", Complete) );
+ }
+ return result;
+ }
+ ///
+ /// Deserializes an XML node to an instance of Order
+ ///
+ internal static Order XmlDeserialize(string payload)
+ {
+ // deserialize to xml and use the overload to do the work
+ return XmlDeserialize( XElement.Parse( payload ) );
+ }
+ internal static Order XmlDeserialize(XElement payload)
+ {
+ var result = new Order();
+ var deserializeId = XmlSerialization.ToDeserializer(e => (long?)e);
+ long? resultId;
+ if (deserializeId(payload, "id", out resultId))
+ {
+ result.Id = resultId;
+ }
+ var deserializePetId = XmlSerialization.ToDeserializer(e => (long?)e);
+ long? resultPetId;
+ if (deserializePetId(payload, "petId", out resultPetId))
+ {
+ result.PetId = resultPetId;
+ }
+ var deserializeQuantity = XmlSerialization.ToDeserializer(e => (int?)e);
+ int? resultQuantity;
+ if (deserializeQuantity(payload, "quantity", out resultQuantity))
+ {
+ result.Quantity = resultQuantity;
+ }
+ var deserializeShipDate = XmlSerialization.ToDeserializer(e => (System.DateTime?)e);
+ System.DateTime? resultShipDate;
+ if (deserializeShipDate(payload, "shipDate", out resultShipDate))
+ {
+ result.ShipDate = resultShipDate;
+ }
+ var deserializeStatus = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultStatus;
+ if (deserializeStatus(payload, "status", out resultStatus))
+ {
+ result.Status = resultStatus;
+ }
+ var deserializeComplete = XmlSerialization.ToDeserializer(e => (bool?)e);
+ bool? resultComplete;
+ if (deserializeComplete(payload, "complete", out resultComplete))
+ {
+ result.Complete = resultComplete;
+ }
+ return result;
+ }
}
}
diff --git a/Samples/petstore/CSharp/Models/Pet.cs b/Samples/petstore/CSharp/Models/Pet.cs
index eaf4446949..3fe7296f47 100644
--- a/Samples/petstore/CSharp/Models/Pet.cs
+++ b/Samples/petstore/CSharp/Models/Pet.cs
@@ -6,6 +6,8 @@ namespace Petstore.Models
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+ using System.Xml;
+ using System.Xml.Linq;
///
/// A pet
@@ -89,6 +91,94 @@ public virtual void Validate()
throw new ValidationException(ValidationRules.CannotBeNull, "PhotoUrls");
}
}
+ ///
+ /// Serializes the object to an XML node
+ ///
+ internal XElement XmlSerialize(XElement result)
+ {
+ if( null != Id )
+ {
+ result.Add(new XElement("id", Id) );
+ }
+ if( null != Category )
+ {
+ result.Add(Category.XmlSerialize(new XElement( "category" )));
+ }
+ if( null != Name )
+ {
+ result.Add(new XElement("name", Name) );
+ }
+ if( null != PhotoUrls )
+ {
+ var seq = new XElement("photoUrl");
+ foreach( var value in PhotoUrls ){
+ seq.Add(new XElement( "photoUrl", value ) );
+ }
+ result.Add(seq);
+ }
+ if( null != Tags )
+ {
+ var seq = new XElement("tag");
+ foreach( var value in Tags ){
+ seq.Add(value.XmlSerialize( new XElement( "tag") ) );
+ }
+ result.Add(seq);
+ }
+ if( null != Status )
+ {
+ result.Add(new XElement("status", Status) );
+ }
+ return result;
+ }
+ ///
+ /// Deserializes an XML node to an instance of Pet
+ ///
+ internal static Pet XmlDeserialize(string payload)
+ {
+ // deserialize to xml and use the overload to do the work
+ return XmlDeserialize( XElement.Parse( payload ) );
+ }
+ internal static Pet XmlDeserialize(XElement payload)
+ {
+ var result = new Pet();
+ var deserializeId = XmlSerialization.ToDeserializer(e => (long?)e);
+ long? resultId;
+ if (deserializeId(payload, "id", out resultId))
+ {
+ result.Id = resultId;
+ }
+ var deserializeCategory = XmlSerialization.ToDeserializer(e => Category.XmlDeserialize(e));
+ Category resultCategory;
+ if (deserializeCategory(payload, "category", out resultCategory))
+ {
+ result.Category = resultCategory;
+ }
+ var deserializeName = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultName;
+ if (deserializeName(payload, "name", out resultName))
+ {
+ result.Name = resultName;
+ }
+ var deserializePhotoUrls = XmlSerialization.CreateListXmlDeserializer(XmlSerialization.ToDeserializer(e => (string)e), "photoUrl");
+ IList resultPhotoUrls;
+ if (deserializePhotoUrls(payload, "photoUrl", out resultPhotoUrls))
+ {
+ result.PhotoUrls = resultPhotoUrls;
+ }
+ var deserializeTags = XmlSerialization.CreateListXmlDeserializer(XmlSerialization.ToDeserializer(e => Tag.XmlDeserialize(e)), "tag");
+ IList resultTags;
+ if (deserializeTags(payload, "tag", out resultTags))
+ {
+ result.Tags = resultTags;
+ }
+ var deserializeStatus = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultStatus;
+ if (deserializeStatus(payload, "status", out resultStatus))
+ {
+ result.Status = resultStatus;
+ }
+ return result;
+ }
}
}
diff --git a/Samples/petstore/CSharp/Models/Tag.cs b/Samples/petstore/CSharp/Models/Tag.cs
index f617295201..abef90b1e2 100644
--- a/Samples/petstore/CSharp/Models/Tag.cs
+++ b/Samples/petstore/CSharp/Models/Tag.cs
@@ -3,6 +3,8 @@ namespace Petstore.Models
{
using Newtonsoft.Json;
using System.Linq;
+ using System.Xml;
+ using System.Xml.Linq;
public partial class Tag
{
@@ -30,6 +32,46 @@ public Tag() { }
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
+ ///
+ /// Serializes the object to an XML node
+ ///
+ internal XElement XmlSerialize(XElement result)
+ {
+ if( null != Id )
+ {
+ result.Add(new XElement("id", Id) );
+ }
+ if( null != Name )
+ {
+ result.Add(new XElement("name", Name) );
+ }
+ return result;
+ }
+ ///
+ /// Deserializes an XML node to an instance of Tag
+ ///
+ internal static Tag XmlDeserialize(string payload)
+ {
+ // deserialize to xml and use the overload to do the work
+ return XmlDeserialize( XElement.Parse( payload ) );
+ }
+ internal static Tag XmlDeserialize(XElement payload)
+ {
+ var result = new Tag();
+ var deserializeId = XmlSerialization.ToDeserializer(e => (long?)e);
+ long? resultId;
+ if (deserializeId(payload, "id", out resultId))
+ {
+ result.Id = resultId;
+ }
+ var deserializeName = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultName;
+ if (deserializeName(payload, "name", out resultName))
+ {
+ result.Name = resultName;
+ }
+ return result;
+ }
}
}
diff --git a/Samples/petstore/CSharp/Models/User.cs b/Samples/petstore/CSharp/Models/User.cs
index 4b10c885a7..d19e9d10e8 100644
--- a/Samples/petstore/CSharp/Models/User.cs
+++ b/Samples/petstore/CSharp/Models/User.cs
@@ -3,6 +3,8 @@ namespace Petstore.Models
{
using Newtonsoft.Json;
using System.Linq;
+ using System.Xml;
+ using System.Xml.Linq;
public partial class User
{
@@ -68,6 +70,106 @@ public User() { }
[JsonProperty(PropertyName = "userStatus")]
public int? UserStatus { get; set; }
+ ///
+ /// Serializes the object to an XML node
+ ///
+ internal XElement XmlSerialize(XElement result)
+ {
+ if( null != Id )
+ {
+ result.Add(new XElement("id", Id) );
+ }
+ if( null != Username )
+ {
+ result.Add(new XElement("username", Username) );
+ }
+ if( null != FirstName )
+ {
+ result.Add(new XElement("firstName", FirstName) );
+ }
+ if( null != LastName )
+ {
+ result.Add(new XElement("lastName", LastName) );
+ }
+ if( null != Email )
+ {
+ result.Add(new XElement("email", Email) );
+ }
+ if( null != Password )
+ {
+ result.Add(new XElement("password", Password) );
+ }
+ if( null != Phone )
+ {
+ result.Add(new XElement("phone", Phone) );
+ }
+ if( null != UserStatus )
+ {
+ result.Add(new XElement("userStatus", UserStatus) );
+ }
+ return result;
+ }
+ ///
+ /// Deserializes an XML node to an instance of User
+ ///
+ internal static User XmlDeserialize(string payload)
+ {
+ // deserialize to xml and use the overload to do the work
+ return XmlDeserialize( XElement.Parse( payload ) );
+ }
+ internal static User XmlDeserialize(XElement payload)
+ {
+ var result = new User();
+ var deserializeId = XmlSerialization.ToDeserializer(e => (long?)e);
+ long? resultId;
+ if (deserializeId(payload, "id", out resultId))
+ {
+ result.Id = resultId;
+ }
+ var deserializeUsername = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultUsername;
+ if (deserializeUsername(payload, "username", out resultUsername))
+ {
+ result.Username = resultUsername;
+ }
+ var deserializeFirstName = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultFirstName;
+ if (deserializeFirstName(payload, "firstName", out resultFirstName))
+ {
+ result.FirstName = resultFirstName;
+ }
+ var deserializeLastName = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultLastName;
+ if (deserializeLastName(payload, "lastName", out resultLastName))
+ {
+ result.LastName = resultLastName;
+ }
+ var deserializeEmail = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultEmail;
+ if (deserializeEmail(payload, "email", out resultEmail))
+ {
+ result.Email = resultEmail;
+ }
+ var deserializePassword = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultPassword;
+ if (deserializePassword(payload, "password", out resultPassword))
+ {
+ result.Password = resultPassword;
+ }
+ var deserializePhone = XmlSerialization.ToDeserializer(e => (string)e);
+ string resultPhone;
+ if (deserializePhone(payload, "phone", out resultPhone))
+ {
+ result.Phone = resultPhone;
+ }
+ var deserializeUserStatus = XmlSerialization.ToDeserializer(e => (int?)e);
+ int? resultUserStatus;
+ if (deserializeUserStatus(payload, "userStatus", out resultUserStatus))
+ {
+ result.UserStatus = resultUserStatus;
+ }
+ return result;
+ }
}
}
diff --git a/Samples/petstore/CSharp/Models/XmlSerialization.cs b/Samples/petstore/CSharp/Models/XmlSerialization.cs
new file mode 100644
index 0000000000..c09a27f84e
--- /dev/null
+++ b/Samples/petstore/CSharp/Models/XmlSerialization.cs
@@ -0,0 +1,90 @@
+namespace Petstore
+{
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Xml;
+ using System.Xml.Linq;
+ internal static class XmlSerialization
+ {
+ internal delegate bool XmlRootDeserializer( XElement root, out T result );
+ internal delegate bool XmlDeserializer( XElement parent, string propertyName, out T result );
+ internal static XmlRootDeserializer Root( XmlDeserializer deserializer ) =>
+ (XElement root, out T result) => deserializer(new XElement("artificialRoot", root), root.Name.LocalName, out result);
+ private static XmlDeserializer Unroot( XmlRootDeserializer deserializer )
+ {
+ return (XElement parent, string propertyName, out T result) => {
+ result = default(T);
+ var element = parent.Element(propertyName);
+ if (element == null)
+ {
+ return false;
+ }
+ return deserializer(element, out result);
+ };
+ }
+ private static XmlRootDeserializer ToRootDeserializer( System.Func unsafeDeserializer )
+ => (XElement root, out T result) => {
+ try
+ {
+ result = unsafeDeserializer(root);
+ return true;
+ }
+ catch
+ {
+ result = default(T);
+ return false;
+ }};
+ internal static XmlDeserializer ToDeserializer( System.Func unsafeDeserializer )
+ => Unroot(ToRootDeserializer(unsafeDeserializer));
+ internal static XmlDeserializer> CreateListXmlDeserializer( XmlDeserializer elementDeserializer, string elementTagName = null /*if isWrapped = false*/ )
+ {
+ if (elementTagName != null)
+ {
+ // create non-wrapped deserializer and forward
+ var slave = CreateListXmlDeserializer( elementDeserializer );
+ return (XElement parent, string propertyName, out IList result) => {
+ result = null;
+ var wrapper = parent.Element(propertyName);
+ return wrapper != null && slave(wrapper, elementTagName, out result);
+ };
+ }
+ var rootElementDeserializer = Root(elementDeserializer);
+ return (XElement parent, string propertyName, out IList result) => {
+ result = new List();
+ foreach (var element in parent.Elements(propertyName))
+ {
+ T elementResult;
+ if (!rootElementDeserializer(element, out elementResult))
+ {
+ return false;
+ }
+ result.Add(elementResult);
+ }
+ return true;
+ };
+ }
+ internal static XmlDeserializer> CreateDictionaryXmlDeserializer( XmlDeserializer elementDeserializer )
+ {
+ return (XElement parent, string propertyName, out IDictionary result) => {
+ result = null;
+ var childElement = parent.Element(propertyName);
+ if (childElement == null)
+ {
+ return false;
+ }
+ result = new Dictionary();
+ foreach (var element in childElement.Elements())
+ {
+ T elementResult;
+ if (!elementDeserializer(childElement, element.Name.LocalName, out elementResult))
+ {
+ return false;
+ }
+ result.Add(element.Name.LocalName, elementResult);
+ }
+ return true;
+ };
+ }
+ }
+}
+
diff --git a/Samples/petstore/CSharp/SwaggerPetstore.cs b/Samples/petstore/CSharp/SwaggerPetstore.cs
index 7cd708d1ec..9e8d9854d5 100644
--- a/Samples/petstore/CSharp/SwaggerPetstore.cs
+++ b/Samples/petstore/CSharp/SwaggerPetstore.cs
@@ -31,12 +31,12 @@ public partial class SwaggerPetstore : ServiceClient, ISwaggerP
///
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Initializes a new instance of the SwaggerPetstore class.
@@ -118,27 +118,27 @@ public SwaggerPetstore(System.Uri baseUri, System.Net.Http.HttpClientHandler roo
private void Initialize()
{
BaseUri = new System.Uri("http://petstore.swagger.io/v2");
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
@@ -186,6 +186,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -301,6 +303,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -412,6 +416,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -534,6 +540,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -594,9 +602,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
+ IList _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.CreateListXmlDeserializer(XmlSerialization.ToDeserializer(e => Pet.XmlDeserialize(e)), null))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -669,6 +685,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -729,9 +747,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
+ IList _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.CreateListXmlDeserializer(XmlSerialization.ToDeserializer(e => Pet.XmlDeserialize(e)), null))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -796,6 +822,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -856,9 +884,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ string _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.ToDeserializer(e => (string)e))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -923,6 +959,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -983,9 +1021,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ Pet _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.ToDeserializer(e => Pet.XmlDeserialize(e)))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1061,6 +1107,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1186,6 +1234,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("api_key", apiKey);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1296,6 +1346,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1420,6 +1472,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1480,9 +1534,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
+ IDictionary _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.CreateDictionaryXmlDeserializer(XmlSerialization.ToDeserializer(e => (int?)e)))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1542,6 +1604,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1608,9 +1672,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ Order _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.ToDeserializer(e => Order.XmlDeserialize(e)))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1685,6 +1757,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1745,9 +1819,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ Order _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.ToDeserializer(e => Order.XmlDeserialize(e)))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1819,6 +1901,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1923,6 +2007,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2030,6 +2116,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2137,6 +2225,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2264,6 +2354,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2324,9 +2416,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ string _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.ToDeserializer(e => (string)e))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2379,6 +2479,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2494,6 +2596,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2554,9 +2658,17 @@ private void Initialize()
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ User _tmp_ = null;
+ if (_httpResponse.Content.Headers.ContentType.MediaType == "application/xml" &&
+ XmlSerialization.Root(XmlSerialization.ToDeserializer(e => User.XmlDeserialize(e)))(System.Xml.Linq.XElement.Parse(_responseContent), out _tmp_))
+ {
+ _result.Body = _tmp_;
+ }else
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2631,6 +2743,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2752,6 +2866,8 @@ private void Initialize()
_httpRequest.Method = new System.Net.Http.HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
diff --git a/Samples/petstore/Go/version.go b/Samples/petstore/Go/version.go
index ffe61fa55c..47dce9eab9 100644
--- a/Samples/petstore/Go/version.go
+++ b/Samples/petstore/Go/version.go
@@ -12,7 +12,7 @@ const (
// Always begin a "tag" with a dash (as per http://semver.org)
tag = "-beta"
semVerFormat = "%s.%s.%s%s"
- userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
+ userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
diff --git a/src/core/AutoRest.Core/Model/Method.cs b/src/core/AutoRest.Core/Model/Method.cs
index b0316b3685..19bb9a5886 100644
--- a/src/core/AutoRest.Core/Model/Method.cs
+++ b/src/core/AutoRest.Core/Model/Method.cs
@@ -78,7 +78,7 @@ public MethodGroup MethodGroup
protected Method()
{
InitializeCollections();
- Name.OnGet += n => CodeNamer.Instance.GetMethodName(n);
+ Name.OnGet += n => CodeNamer.Instance.GetMethodName(n.Else("unnamed_method"));
Group.OnGet += groupName => CodeNamer.Instance.GetMethodGroupName(groupName);
}
diff --git a/src/core/AutoRest.Core/Model/Parameter.cs b/src/core/AutoRest.Core/Model/Parameter.cs
index 8f9a2eb957..045dac1f16 100644
--- a/src/core/AutoRest.Core/Model/Parameter.cs
+++ b/src/core/AutoRest.Core/Model/Parameter.cs
@@ -26,11 +26,32 @@ protected Parameter()
Name.OnGet += v => CodeNamer.Instance.GetParameterName(Extensions.GetValue("x-ms-client-name").Else(v));
}
+ private Method _method;
///
/// The method that this parameter belongs to.
///
[JsonIgnore]
- public Method Method { get; set; }
+ public Method Method
+ {
+ get { return _method; }
+ set
+ {
+ // when the reference to the parent is set
+ // we should disambiguate the name
+ // it is imporant that this reference gets set before
+ // the item is actually added to the containing collection.
+
+ if (!ReferenceEquals(_method, value))
+ {
+ // only perform disambiguation if this item is not already
+ // referencing the parent
+ _method = value;
+
+ // (which implies that it's in the collection, but I can't prove that.)
+ Disambiguate();
+ }
+ }
+ }
///
/// Indicates whether the parameter should be set via a property on the client instance
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs
index 6482d4d2c2..11e20307ec 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/AutoRestDurationTestService.cs
@@ -33,12 +33,12 @@ public partial class AutoRestDurationTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -273,27 +273,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/DurationOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/DurationOperations.cs
index f1ac0d4cbb..2ebe1c80a8 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/DurationOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/DurationOperations.cs
@@ -105,6 +105,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -151,7 +153,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -184,7 +186,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -257,6 +259,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -306,7 +310,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -394,6 +398,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -440,7 +446,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -473,7 +479,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -546,6 +552,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -592,7 +600,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -625,7 +633,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/IAutoRestDurationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/IAutoRestDurationTestService.cs
index e9d0c13923..325db0fd7e 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/IAutoRestDurationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDuration/IAutoRestDurationTestService.cs
@@ -27,12 +27,12 @@ public partial interface IAutoRestDurationTestService : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs
index 81725b633f..470bfa4956 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs
@@ -32,12 +32,12 @@ public partial class AutoRestDurationTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -272,27 +272,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs
index 8b96ac1868..6674c4053b 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/DurationOperations.cs
@@ -104,6 +104,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -256,6 +258,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -305,7 +309,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -393,6 +397,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -439,7 +445,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -472,7 +478,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -545,6 +551,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -591,7 +599,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -624,7 +632,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IAutoRestDurationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IAutoRestDurationTestService.cs
index 0d036c4dfc..5881c9d53e 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IAutoRestDurationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/IAutoRestDurationTestService.cs
@@ -26,12 +26,12 @@ public partial interface IAutoRestDurationTestService : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs
index 9229eecb85..47c0478dd6 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/AutoRestDurationTestService.cs
@@ -32,12 +32,12 @@ public partial class AutoRestDurationTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -272,27 +272,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs
index 3e4a3c91f7..595fd09501 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/DurationOperations.cs
@@ -104,6 +104,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -256,6 +258,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -305,7 +309,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -393,6 +397,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -439,7 +445,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -472,7 +478,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -545,6 +551,8 @@ internal DurationOperations(AutoRestDurationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -591,7 +599,7 @@ internal DurationOperations(AutoRestDurationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -624,7 +632,7 @@ internal DurationOperations(AutoRestDurationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IAutoRestDurationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IAutoRestDurationTestService.cs
index 79c9bee58d..53e7e01304 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IAutoRestDurationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureBodyDurationNoSync/IAutoRestDurationTestService.cs
@@ -26,12 +26,12 @@ public partial interface IAutoRestDurationTestService : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ArrayOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ArrayOperations.cs
index 5c2db0ae93..bd8f3269b7 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ArrayOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ArrayOperations.cs
@@ -104,6 +104,8 @@ internal ArrayOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal ArrayOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal ArrayOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -261,6 +263,8 @@ internal ArrayOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -313,7 +317,7 @@ internal ArrayOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -401,6 +405,8 @@ internal ArrayOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -447,7 +453,7 @@ internal ArrayOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -480,7 +486,7 @@ internal ArrayOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -558,6 +564,8 @@ internal ArrayOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -610,7 +618,7 @@ internal ArrayOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -699,6 +707,8 @@ internal ArrayOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -745,7 +755,7 @@ internal ArrayOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -778,7 +788,7 @@ internal ArrayOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs
index 37c0ddd17c..737e550dd5 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/AzureCompositeModel.cs
@@ -35,12 +35,12 @@ public partial class AzureCompositeModel : ServiceClient, I
///
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -323,27 +323,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
@@ -437,6 +437,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -483,7 +485,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -516,7 +518,7 @@ private void Initialize()
{
_result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -631,6 +633,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -683,7 +687,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -716,7 +720,7 @@ private void Initialize()
{
_result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -831,6 +835,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -883,7 +889,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -916,7 +922,7 @@ private void Initialize()
{
_result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/BasicOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/BasicOperations.cs
index dc2aaa551c..ee3dc59683 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/BasicOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/BasicOperations.cs
@@ -104,6 +104,8 @@ internal BasicOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal BasicOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal BasicOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -273,6 +275,8 @@ internal BasicOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -325,7 +329,7 @@ internal BasicOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -413,6 +417,8 @@ internal BasicOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -459,7 +465,7 @@ internal BasicOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -492,7 +498,7 @@ internal BasicOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -565,6 +571,8 @@ internal BasicOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -611,7 +619,7 @@ internal BasicOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -644,7 +652,7 @@ internal BasicOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -717,6 +725,8 @@ internal BasicOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -763,7 +773,7 @@ internal BasicOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -796,7 +806,7 @@ internal BasicOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -870,6 +880,8 @@ internal BasicOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -916,7 +928,7 @@ internal BasicOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -949,7 +961,7 @@ internal BasicOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/DictionaryOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/DictionaryOperations.cs
index 21537f9d8d..2afa5347b8 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/DictionaryOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/DictionaryOperations.cs
@@ -104,6 +104,8 @@ internal DictionaryOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal DictionaryOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal DictionaryOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -261,6 +263,8 @@ internal DictionaryOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -313,7 +317,7 @@ internal DictionaryOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -401,6 +405,8 @@ internal DictionaryOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -447,7 +453,7 @@ internal DictionaryOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -480,7 +486,7 @@ internal DictionaryOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -558,6 +564,8 @@ internal DictionaryOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -610,7 +618,7 @@ internal DictionaryOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -698,6 +706,8 @@ internal DictionaryOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -744,7 +754,7 @@ internal DictionaryOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -777,7 +787,7 @@ internal DictionaryOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -851,6 +861,8 @@ internal DictionaryOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -897,7 +909,7 @@ internal DictionaryOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -930,7 +942,7 @@ internal DictionaryOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/IAzureCompositeModel.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/IAzureCompositeModel.cs
index d6a144caaa..bcffc3499a 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/IAzureCompositeModel.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/IAzureCompositeModel.cs
@@ -31,12 +31,12 @@ public partial interface IAzureCompositeModel : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/InheritanceOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/InheritanceOperations.cs
index 2f7a83f3d2..b41c7b9a98 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/InheritanceOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/InheritanceOperations.cs
@@ -104,6 +104,8 @@ internal InheritanceOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal InheritanceOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal InheritanceOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -269,6 +271,8 @@ internal InheritanceOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -321,7 +325,7 @@ internal InheritanceOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Cookiecuttershark.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Cookiecuttershark.cs
index beaf0fd33e..cdc22e776c 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Cookiecuttershark.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Cookiecuttershark.cs
@@ -14,7 +14,7 @@ namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
using System.Collections.Generic;
using System.Linq;
- [Newtonsoft.Json.JsonObject("cookiecuttershark")]
+ [JsonObject("cookiecuttershark")]
public partial class Cookiecuttershark : Shark
{
///
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/FishInner.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/FishInner.cs
index d6ab1cabde..6a9cbce169 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/FishInner.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/FishInner.cs
@@ -14,7 +14,7 @@ namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
using System.Collections.Generic;
using System.Linq;
- [Newtonsoft.Json.JsonObject("Fish")]
+ [JsonObject("Fish")]
public partial class FishInner
{
///
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Goblinshark.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Goblinshark.cs
index b85f2fd339..faa8ce84cf 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Goblinshark.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Goblinshark.cs
@@ -14,7 +14,7 @@ namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
using System.Collections.Generic;
using System.Linq;
- [Newtonsoft.Json.JsonObject("goblin")]
+ [JsonObject("goblin")]
public partial class Goblinshark : Shark
{
///
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Salmon.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Salmon.cs
index 20cee770b2..ce79211351 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Salmon.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Salmon.cs
@@ -14,7 +14,7 @@ namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
using System.Collections.Generic;
using System.Linq;
- [Newtonsoft.Json.JsonObject("salmon")]
+ [JsonObject("salmon")]
public partial class Salmon : FishInner
{
///
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Sawshark.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Sawshark.cs
index 3ade8218ac..4f6c3fe9c7 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Sawshark.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Sawshark.cs
@@ -14,7 +14,7 @@ namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
using System.Collections.Generic;
using System.Linq;
- [Newtonsoft.Json.JsonObject("sawshark")]
+ [JsonObject("sawshark")]
public partial class Sawshark : Shark
{
///
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Shark.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Shark.cs
index 9284383305..fec7dd4ae3 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Shark.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/Models/Shark.cs
@@ -14,7 +14,7 @@ namespace Fixtures.AcceptanceTestsAzureCompositeModelClient.Models
using System.Collections.Generic;
using System.Linq;
- [Newtonsoft.Json.JsonObject("shark")]
+ [JsonObject("shark")]
public partial class Shark : FishInner
{
///
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphicrecursiveOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphicrecursiveOperations.cs
index 092200d9ef..ec1e8022b8 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphicrecursiveOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphicrecursiveOperations.cs
@@ -104,6 +104,8 @@ internal PolymorphicrecursiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal PolymorphicrecursiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal PolymorphicrecursiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -323,6 +325,8 @@ internal PolymorphicrecursiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -375,7 +379,7 @@ internal PolymorphicrecursiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphismOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphismOperations.cs
index 2bca4faf4d..84e4b66bdb 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphismOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PolymorphismOperations.cs
@@ -104,6 +104,8 @@ internal PolymorphismOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal PolymorphismOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal PolymorphismOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -303,6 +305,8 @@ internal PolymorphismOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -355,7 +359,7 @@ internal PolymorphismOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -485,6 +489,8 @@ internal PolymorphismOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -537,7 +543,7 @@ internal PolymorphismOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PrimitiveOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PrimitiveOperations.cs
index 153b5e48ae..a813adcb2a 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PrimitiveOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/PrimitiveOperations.cs
@@ -104,6 +104,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -267,6 +269,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -319,7 +323,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -407,6 +411,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -453,7 +459,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -486,7 +492,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -570,6 +576,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -622,7 +630,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -710,6 +718,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -756,7 +766,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -789,7 +799,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -873,6 +883,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -925,7 +937,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1013,6 +1025,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1059,7 +1073,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1092,7 +1106,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1177,6 +1191,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1229,7 +1245,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1317,6 +1333,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1363,7 +1381,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1396,7 +1414,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1480,6 +1498,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1532,7 +1552,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1620,6 +1640,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1666,7 +1688,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1699,7 +1721,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1783,6 +1805,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1835,7 +1859,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1923,6 +1947,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1969,7 +1995,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2002,7 +2028,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2086,6 +2112,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2138,7 +2166,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2226,6 +2254,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2272,7 +2302,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2305,7 +2335,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2389,6 +2419,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2441,7 +2473,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2529,6 +2561,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2575,7 +2609,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2608,7 +2642,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2693,6 +2727,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2745,7 +2781,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2833,6 +2869,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2879,7 +2917,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2912,7 +2950,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2990,6 +3028,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3042,7 +3082,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3130,6 +3170,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3176,7 +3218,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3209,7 +3251,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3287,6 +3329,8 @@ internal PrimitiveOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3339,7 +3383,7 @@ internal PrimitiveOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ReadonlypropertyOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ReadonlypropertyOperations.cs
index 8dce25c22f..cf709dd62e 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ReadonlypropertyOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureCompositeModelClient/ReadonlypropertyOperations.cs
@@ -104,6 +104,8 @@ internal ReadonlypropertyOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -150,7 +152,7 @@ internal ReadonlypropertyOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -183,7 +185,7 @@ internal ReadonlypropertyOperations(AzureCompositeModel client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -261,6 +263,8 @@ internal ReadonlypropertyOperations(AzureCompositeModel client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -313,7 +317,7 @@ internal ReadonlypropertyOperations(AzureCompositeModel client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs
index 7f60f9cec3..df93beea30 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/AutoRestParameterGroupingTestService.cs
@@ -33,12 +33,12 @@ public partial class AutoRestParameterGroupingTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -273,27 +273,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IAutoRestParameterGroupingTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IAutoRestParameterGroupingTestService.cs
index 3f55e43f65..614fab929b 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IAutoRestParameterGroupingTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/IAutoRestParameterGroupingTestService.cs
@@ -27,12 +27,12 @@ public partial interface IAutoRestParameterGroupingTestService : System.IDisposa
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperations.cs
index d72191158d..afc1171505 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureParameterGrouping/ParameterGroupingOperations.cs
@@ -156,6 +156,8 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
}
_httpRequest.Headers.TryAddWithoutValidation("customHeader", customHeader);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -205,7 +207,7 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -317,6 +319,8 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
}
_httpRequest.Headers.TryAddWithoutValidation("customHeader", customHeader);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -363,7 +367,7 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -502,6 +506,8 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
}
_httpRequest.Headers.TryAddWithoutValidation("header-two", headerTwo);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -548,7 +554,7 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -660,6 +666,8 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
}
_httpRequest.Headers.TryAddWithoutValidation("header-one", headerOne);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -706,7 +714,7 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs
index 34fb3d07c8..9799fa460b 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/AutoRestReportServiceForAzure.cs
@@ -35,12 +35,12 @@ public partial class AutoRestReportServiceForAzure : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -269,27 +269,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
@@ -353,6 +353,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -399,7 +401,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -432,7 +434,7 @@ private void Initialize()
{
_result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/IAutoRestReportServiceForAzure.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/IAutoRestReportServiceForAzure.cs
index d9c22a04b8..f92e857f90 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/IAutoRestReportServiceForAzure.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureReport/IAutoRestReportServiceForAzure.cs
@@ -31,12 +31,12 @@ public partial interface IAutoRestReportServiceForAzure : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs
index f7ccb81d7e..1ccfb67b59 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/AutoRestResourceFlatteningTestService.cs
@@ -35,12 +35,12 @@ public partial class AutoRestResourceFlatteningTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -269,28 +269,28 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
SerializationSettings.Converters.Add(new TransformationJsonConverter());
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
@@ -357,6 +357,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -409,7 +411,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -498,6 +500,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -544,7 +548,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -577,7 +581,7 @@ private void Initialize()
{
_result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -652,6 +656,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -704,7 +710,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -793,6 +799,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -839,7 +847,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -872,7 +880,7 @@ private void Initialize()
{
_result.Body = SafeJsonConvert.DeserializeObject>(_responseContent, DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -947,6 +955,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -999,7 +1009,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1088,6 +1098,8 @@ private void Initialize()
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1134,7 +1146,7 @@ private void Initialize()
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1167,7 +1179,7 @@ private void Initialize()
{
_result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/IAutoRestResourceFlatteningTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/IAutoRestResourceFlatteningTestService.cs
index 1ead9dc154..c58fd404b5 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/IAutoRestResourceFlatteningTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureResource/IAutoRestResourceFlatteningTestService.cs
@@ -31,12 +31,12 @@ public partial interface IAutoRestResourceFlatteningTestService : System.IDispos
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionDefaultOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionDefaultOperations.cs
index b7e5f3b418..2cd39664e0 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionDefaultOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionDefaultOperations.cs
@@ -116,6 +116,8 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -162,7 +164,7 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -261,6 +263,8 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -307,7 +311,7 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -406,6 +410,8 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -452,7 +458,7 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -551,6 +557,8 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -597,7 +605,7 @@ internal ApiVersionDefaultOperations(AutoRestAzureSpecialParametersTestClient cl
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionLocalOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionLocalOperations.cs
index fb24556da5..bbe50de042 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionLocalOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/ApiVersionLocalOperations.cs
@@ -109,6 +109,8 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -155,7 +157,7 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -250,6 +252,8 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -296,7 +300,7 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -388,6 +392,8 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -434,7 +440,7 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -526,6 +532,8 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -572,7 +580,7 @@ internal ApiVersionLocalOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs
index 8988bb1bc0..25e2038688 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/AutoRestAzureSpecialParametersTestClient.cs
@@ -33,12 +33,12 @@ public partial class AutoRestAzureSpecialParametersTestClient : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -328,27 +328,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/HeaderOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/HeaderOperations.cs
index 54f754f991..5b7c99c69b 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/HeaderOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/HeaderOperations.cs
@@ -125,6 +125,8 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -171,7 +173,7 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -198,9 +200,9 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -301,6 +303,8 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("foo-client-request-id", fooClientRequestId);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -347,7 +351,7 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -374,9 +378,9 @@ internal HeaderOperations(AutoRestAzureSpecialParametersTestClient client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/IAutoRestAzureSpecialParametersTestClient.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/IAutoRestAzureSpecialParametersTestClient.cs
index 55e799de97..fb4ae899bd 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/IAutoRestAzureSpecialParametersTestClient.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/IAutoRestAzureSpecialParametersTestClient.cs
@@ -27,12 +27,12 @@ public partial interface IAutoRestAzureSpecialParametersTestClient : System.IDis
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/OdataOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/OdataOperations.cs
index e1cce46ce1..f2acf7ebf5 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/OdataOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/OdataOperations.cs
@@ -116,6 +116,8 @@ internal OdataOperations(AutoRestAzureSpecialParametersTestClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -162,7 +164,7 @@ internal OdataOperations(AutoRestAzureSpecialParametersTestClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SkipUrlEncodingOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SkipUrlEncodingOperations.cs
index 60e219aca0..39be6cc5e9 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SkipUrlEncodingOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SkipUrlEncodingOperations.cs
@@ -117,6 +117,8 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -163,7 +165,7 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -263,6 +265,8 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -309,7 +313,7 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -397,6 +401,8 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -443,7 +449,7 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -547,6 +553,8 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -593,7 +601,7 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -686,6 +694,8 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -732,7 +742,7 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -836,6 +846,8 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -882,7 +894,7 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -974,6 +986,8 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1020,7 +1034,7 @@ internal SkipUrlEncodingOperations(AutoRestAzureSpecialParametersTestClient clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInCredentialsOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInCredentialsOperations.cs
index a0d5963988..8eb5b0b627 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInCredentialsOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInCredentialsOperations.cs
@@ -114,6 +114,8 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -160,7 +162,7 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -258,6 +260,8 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -304,7 +308,7 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -409,6 +413,8 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -455,7 +461,7 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -552,6 +558,8 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -598,7 +606,7 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -695,6 +703,8 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -741,7 +751,7 @@ internal SubscriptionInCredentialsOperations(AutoRestAzureSpecialParametersTestC
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInMethodOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInMethodOperations.cs
index c1b169f5a4..5887e0342d 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInMethodOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/SubscriptionInMethodOperations.cs
@@ -118,6 +118,8 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -164,7 +166,7 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -267,6 +269,8 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -313,7 +317,7 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -414,6 +418,8 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -460,7 +466,7 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -562,6 +568,8 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -608,7 +616,7 @@ internal SubscriptionInMethodOperations(AutoRestAzureSpecialParametersTestClient
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/XMsClientRequestIdOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/XMsClientRequestIdOperations.cs
index 0bdf95df26..85bec7fed7 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/XMsClientRequestIdOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/AzureSpecials/XMsClientRequestIdOperations.cs
@@ -103,6 +103,8 @@ internal XMsClientRequestIdOperations(AutoRestAzureSpecialParametersTestClient c
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -255,6 +257,8 @@ internal XMsClientRequestIdOperations(AutoRestAzureSpecialParametersTestClient c
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -301,7 +305,7 @@ internal XMsClientRequestIdOperations(AutoRestAzureSpecialParametersTestClient c
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs
index a68390380f..a6b77691a7 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/AutoRestParameterizedHostTestClient.cs
@@ -33,12 +33,12 @@ public partial class AutoRestParameterizedHostTestClient : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -165,27 +165,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/IAutoRestParameterizedHostTestClient.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/IAutoRestParameterizedHostTestClient.cs
index 615c995f47..8044140ac3 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/IAutoRestParameterizedHostTestClient.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/IAutoRestParameterizedHostTestClient.cs
@@ -26,12 +26,12 @@ public partial interface IAutoRestParameterizedHostTestClient : System.IDisposab
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/PathsOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/PathsOperations.cs
index 53e018147b..7b1f9caf61 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/PathsOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/CustomBaseUri/PathsOperations.cs
@@ -122,6 +122,8 @@ internal PathsOperations(AutoRestParameterizedHostTestClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -168,7 +170,7 @@ internal PathsOperations(AutoRestParameterizedHostTestClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs
index 1135f75f61..2d9a78cfb6 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/AutoRestHeadTestService.cs
@@ -32,12 +32,12 @@ public partial class AutoRestHeadTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -272,27 +272,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/HttpSuccessOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/HttpSuccessOperations.cs
index 14e08c5ad5..48000867de 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/HttpSuccessOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/HttpSuccessOperations.cs
@@ -101,6 +101,8 @@ internal HttpSuccessOperations(AutoRestHeadTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -148,7 +150,7 @@ internal HttpSuccessOperations(AutoRestHeadTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -238,6 +240,8 @@ internal HttpSuccessOperations(AutoRestHeadTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -285,7 +289,7 @@ internal HttpSuccessOperations(AutoRestHeadTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -375,6 +379,8 @@ internal HttpSuccessOperations(AutoRestHeadTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -422,7 +428,7 @@ internal HttpSuccessOperations(AutoRestHeadTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/IAutoRestHeadTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/IAutoRestHeadTestService.cs
index d74b37c4a5..2f2bf4843a 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/IAutoRestHeadTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Head/IAutoRestHeadTestService.cs
@@ -26,12 +26,12 @@ public partial interface IAutoRestHeadTestService : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs
index 81ce674579..5d806ca969 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/AutoRestHeadExceptionTestService.cs
@@ -32,12 +32,12 @@ public partial class AutoRestHeadExceptionTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -272,27 +272,27 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/HeadExceptionOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/HeadExceptionOperations.cs
index e35df5af69..a5fd2a7fb7 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/HeadExceptionOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/HeadExceptionOperations.cs
@@ -100,6 +100,8 @@ internal HeadExceptionOperations(AutoRestHeadExceptionTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -228,6 +230,8 @@ internal HeadExceptionOperations(AutoRestHeadExceptionTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -356,6 +360,8 @@ internal HeadExceptionOperations(AutoRestHeadExceptionTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/IAutoRestHeadExceptionTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/IAutoRestHeadExceptionTestService.cs
index fa6d4465a5..02407f1244 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/IAutoRestHeadExceptionTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/HeadExceptions/IAutoRestHeadExceptionTestService.cs
@@ -26,12 +26,12 @@ public partial interface IAutoRestHeadExceptionTestService : System.IDisposable
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs
index f5699127e3..6d9666c01a 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/AutoRestLongRunningOperationTestService.cs
@@ -33,12 +33,12 @@ public partial class AutoRestLongRunningOperationTestService : ServiceClient
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
@@ -291,28 +291,28 @@ private void Initialize()
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ SerializationSettings = new JsonSerializerSettings
{
- Formatting = Newtonsoft.Json.Formatting.Indented,
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ Formatting = Formatting.Indented,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
};
SerializationSettings.Converters.Add(new TransformationJsonConverter());
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
- DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
- DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
- NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
- ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ DateFormatHandling = DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = DateTimeZoneHandling.Utc,
+ NullValueHandling = NullValueHandling.Ignore,
+ ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ Converters = new List
{
new Iso8601TimeSpanConverter()
}
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/IAutoRestLongRunningOperationTestService.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/IAutoRestLongRunningOperationTestService.cs
index c56e00cb29..566612d7e1 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/IAutoRestLongRunningOperationTestService.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/IAutoRestLongRunningOperationTestService.cs
@@ -27,12 +27,12 @@ public partial interface IAutoRestLongRunningOperationTestService : System.IDisp
///
/// Gets or sets json serialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
+ JsonSerializerSettings SerializationSettings { get; }
///
/// Gets or sets json deserialization settings.
///
- Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
+ JsonSerializerSettings DeserializationSettings { get; }
///
/// Credentials needed for the client to connect to Azure.
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LRORetrysOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LRORetrysOperations.cs
index 7e5a342c8a..ea7e50a7df 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LRORetrysOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LRORetrysOperations.cs
@@ -254,6 +254,8 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -307,7 +309,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -344,7 +346,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -362,7 +364,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -442,6 +444,8 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -495,7 +499,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -532,7 +536,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -544,9 +548,9 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -621,6 +625,8 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -668,7 +674,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -705,7 +711,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -723,7 +729,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -735,9 +741,9 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -808,6 +814,8 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -855,7 +863,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -886,9 +894,9 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -959,6 +967,8 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1006,7 +1016,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1037,9 +1047,9 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1114,6 +1124,8 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1167,7 +1179,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1198,9 +1210,9 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1276,6 +1288,8 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1329,7 +1343,7 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1360,9 +1374,9 @@ internal LRORetrysOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROSADsOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROSADsOperations.cs
index a0dc0c2919..12e08af3da 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROSADsOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROSADsOperations.cs
@@ -612,6 +612,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -665,7 +667,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -702,7 +704,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -720,7 +722,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -798,6 +800,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -851,7 +855,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -888,7 +892,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -906,7 +910,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -984,6 +988,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1037,7 +1043,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1074,7 +1080,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1092,7 +1098,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1171,6 +1177,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1224,7 +1232,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1261,7 +1269,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1273,9 +1281,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1344,6 +1352,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1391,7 +1401,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1422,9 +1432,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1493,6 +1503,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1540,7 +1552,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1571,9 +1583,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1644,6 +1656,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1691,7 +1705,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1722,9 +1736,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1797,6 +1811,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1850,7 +1866,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1881,9 +1897,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1956,6 +1972,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2009,7 +2027,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2040,9 +2058,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2117,6 +2135,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2170,7 +2190,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2201,9 +2221,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2280,6 +2300,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2333,7 +2355,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2370,7 +2392,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2388,7 +2410,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2467,6 +2489,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2520,7 +2544,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2557,7 +2581,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2569,9 +2593,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2649,6 +2673,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2702,7 +2728,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2739,7 +2765,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2751,9 +2777,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2823,6 +2849,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2870,7 +2898,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2961,6 +2989,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3008,7 +3038,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3039,9 +3069,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3115,6 +3145,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3168,7 +3200,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3199,9 +3231,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3276,6 +3308,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3329,7 +3363,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3360,9 +3394,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3439,6 +3473,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3492,7 +3528,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3529,7 +3565,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3608,6 +3644,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3661,7 +3699,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3698,7 +3736,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3710,9 +3748,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3790,6 +3828,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3843,7 +3883,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3880,7 +3920,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3892,9 +3932,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3964,6 +4004,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4011,7 +4053,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -4042,9 +4084,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -4114,6 +4156,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4161,7 +4205,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -4192,9 +4236,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -4265,6 +4309,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4312,7 +4358,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -4343,9 +4389,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -4419,6 +4465,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4472,7 +4520,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -4503,9 +4551,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -4580,6 +4628,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4633,7 +4683,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -4664,9 +4714,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -4741,6 +4791,8 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4794,7 +4846,7 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -4825,9 +4877,9 @@ internal LROSADsOperations(AutoRestLongRunningOperationTestService client)
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsCustomHeaderOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsCustomHeaderOperations.cs
index c793e07cc1..27242a2c41 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsCustomHeaderOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsCustomHeaderOperations.cs
@@ -204,6 +204,8 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -257,7 +259,7 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -294,7 +296,7 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -306,9 +308,9 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -388,6 +390,8 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -441,7 +445,7 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -478,7 +482,7 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -496,7 +500,7 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -573,6 +577,8 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -626,7 +632,7 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -657,9 +663,9 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -736,6 +742,8 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -789,7 +797,7 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -820,9 +828,9 @@ internal LROsCustomHeaderOperations(AutoRestLongRunningOperationTestService clie
}
try
{
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings));
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
diff --git a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsOperations.cs b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsOperations.cs
index e431b50077..b618733795 100644
--- a/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsOperations.cs
+++ b/src/generator/AutoRest.CSharp.Azure.Fluent.Tests/Expected/AcceptanceTests/Lro/LROsOperations.cs
@@ -819,6 +819,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -872,7 +874,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -909,7 +911,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -987,6 +989,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1040,7 +1044,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1077,7 +1081,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1156,6 +1160,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1209,7 +1215,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1246,7 +1252,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1326,6 +1332,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1379,7 +1387,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1416,7 +1424,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1434,7 +1442,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1514,6 +1522,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1567,7 +1577,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1604,7 +1614,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1684,6 +1694,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1737,7 +1749,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1774,7 +1786,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1792,7 +1804,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1872,6 +1884,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1925,7 +1939,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1962,7 +1976,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2041,6 +2055,8 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2094,7 +2110,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2131,7 +2147,7 @@ internal LROsOperations(AutoRestLongRunningOperationTestService client)
{
_result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject