diff --git a/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid b/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid index 9c1fcbae48..982c8a0d97 100644 --- a/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid +++ b/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid @@ -37,10 +37,10 @@ { {% endif -%} {% if UseRequestAndResponseSerializationSettings -%} - _requestSettings = new System.Lazy<{{ JsonSerializerSettingsType }}>(() => CreateSerializerSettings(true)); - _responseSettings = new System.Lazy<{{ JsonSerializerSettingsType }}>(() => CreateSerializerSettings(false)); + _requestSettings = new System.Lazy<{{ JsonSerializerSettingsType }}>(() => CreateSerializerSettings(true), true); + _responseSettings = new System.Lazy<{{ JsonSerializerSettingsType }}>(() => CreateSerializerSettings(false), true); {% else -%} - _settings = new System.Lazy<{{ JsonSerializerSettingsType }}>(CreateSerializerSettings); + _settings = new System.Lazy<{{ JsonSerializerSettingsType }}>(CreateSerializerSettings, true); {% endif -%} {% template Client.Class.Constructor %} }