@@ -47,11 +47,10 @@ public virtual string Serialize(object model, string[] exclusions = null, int ma
4747 if ( maxDepth < 1 )
4848 maxDepth = Int32 . MaxValue ;
4949
50- var excludedPropertyNames = new HashSet < string > ( exclusions ?? new string [ 0 ] , StringComparer . OrdinalIgnoreCase ) ;
5150 using ( var sw = new StringWriter ( ) ) {
52- using ( var jw = new JsonTextWriterWithExclusions ( sw , excludedPropertyNames ) ) {
51+ using ( var jw = new JsonTextWriterWithExclusions ( sw , exclusions ) ) {
5352 jw . Formatting = Formatting . None ;
54- Func < JsonProperty , object , bool > include = ( property , value ) => ShouldSerialize ( jw , property , value , maxDepth , excludedPropertyNames ) ;
53+ Func < JsonProperty , object , bool > include = ( property , value ) => ShouldSerialize ( jw , property , value , maxDepth , exclusions ) ;
5554 var resolver = new ExceptionlessContractResolver ( include ) ;
5655 serializer . ContractResolver = resolver ;
5756 if ( continueOnSerializationError )
@@ -71,9 +70,9 @@ public virtual object Deserialize(string json, Type type) {
7170 return JsonConvert . DeserializeObject ( json , type , _serializerSettings ) ;
7271 }
7372
74- private bool ShouldSerialize ( JsonTextWriterWithDepth jw , JsonProperty property , object obj , int maxDepth , ISet < string > excludedPropertyNames ) {
73+ private bool ShouldSerialize ( JsonTextWriterWithDepth jw , JsonProperty property , object obj , int maxDepth , string [ ] excludedPropertyNames ) {
7574 try {
76- if ( excludedPropertyNames != null && ( property . UnderlyingName . AnyWildcardMatches ( excludedPropertyNames , true ) || property . PropertyName . AnyWildcardMatches ( excludedPropertyNames , true ) ) )
75+ if ( excludedPropertyNames != null && excludedPropertyNames . Length > 0 && ( property . UnderlyingName . AnyWildcardMatches ( excludedPropertyNames , ignoreCase : true ) || property . PropertyName . AnyWildcardMatches ( excludedPropertyNames , ignoreCase : true ) ) )
7776 return false ;
7877
7978 bool isPrimitiveType = DefaultContractResolver . IsJsonPrimitiveType ( property . PropertyType ) ;
0 commit comments