Clean up use of PreserveDependencyAttribute in System.Text.Json (dotnet/corefx#42146)
authorStephen Toub <stoub@microsoft.com>
Sat, 26 Oct 2019 20:03:21 +0000 (16:03 -0400)
committerGitHub <noreply@github.com>
Sat, 26 Oct 2019 20:03:21 +0000 (16:03 -0400)
It's not necessary to specify the assembly name when the consumer is in the same assembly.

Commit migrated from https://github.com/dotnet/corefx/commit/e13b93bb645db8a2b77b9ee7663b56c3af6f2fbd

src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonConverterEnum.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonKeyValuePairConverter.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.AddProperty.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonStringEnumConverter.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ReflectionEmitMemberAccessor.cs
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/ReflectionMemberAccessor.cs

index 17bb89a..d8e7aad 100644 (file)
@@ -20,8 +20,7 @@ namespace System.Text.Json.Serialization.Converters
 
         [PreserveDependency(
             ".ctor(System.Text.Json.Serialization.Converters.EnumConverterOptions)",
-            "System.Text.Json.Serialization.Converters.JsonConverterEnum`1",
-            "System.Text.Json")]
+            "System.Text.Json.Serialization.Converters.JsonConverterEnum`1")]
         public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options)
         {
             JsonConverter converter = (JsonConverter)Activator.CreateInstance(
index 13aa4e7..8fa37cb 100644 (file)
@@ -19,7 +19,7 @@ namespace System.Text.Json.Serialization.Converters
             return (generic == typeof(KeyValuePair<,>));
         }
 
-        [PreserveDependency(".ctor()", "System.Text.Json.Serialization.Converters.JsonKeyValuePairConverter`2", "System.Text.Json")]
+        [PreserveDependency(".ctor()", "System.Text.Json.Serialization.Converters.JsonKeyValuePairConverter`2")]
         public override JsonConverter CreateConverter(Type type, JsonSerializerOptions options)
         {
             Type keyType = type.GetGenericArguments()[0];
index 0939787..7337db0 100644 (file)
@@ -45,8 +45,8 @@ namespace System.Text.Json
                 options);
         }
 
-        [PreserveDependency(".ctor()", "System.Text.Json.JsonPropertyInfoNullable`2", "System.Text.Json")]
-        [PreserveDependency(".ctor()", "System.Text.Json.Serialization.JsonPropertyInfoNotNullableContravariant`4", "System.Text.Json")]
+        [PreserveDependency(".ctor()", "System.Text.Json.JsonPropertyInfoNullable`2")]
+        [PreserveDependency(".ctor()", "System.Text.Json.Serialization.JsonPropertyInfoNotNullableContravariant`4")]
         internal static JsonPropertyInfo CreateProperty(
             Type declaredPropertyType,
             Type runtimePropertyType,
index bdd227b..9daddb0 100644 (file)
@@ -56,8 +56,7 @@ namespace System.Text.Json.Serialization
         /// <inheritdoc />
         [PreserveDependency(
             ".ctor(System.Text.Json.Serialization.Converters.EnumConverterOptions, System.Text.Json.JsonNamingPolicy)",
-            "System.Text.Json.Serialization.Converters.JsonConverterEnum`1",
-            "System.Text.Json")]
+            "System.Text.Json.Serialization.Converters.JsonConverterEnum`1")]
         public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
         {
             JsonConverter converter = (JsonConverter)Activator.CreateInstance(
index de70079..323174d 100644 (file)
@@ -61,7 +61,7 @@ namespace System.Text.Json
             return (Action<TProperty>)addMethod.CreateDelegate(typeof(Action<TProperty>), target);
         }
 
-        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableEnumerableCreator`2", "System.Text.Json")]
+        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableEnumerableCreator`2")]
         public override ImmutableCollectionCreator ImmutableCollectionCreateRange(Type constructingType, Type collectionType, Type elementType)
         {
             MethodInfo createRange = ImmutableCollectionCreateRangeMethod(constructingType, elementType);
@@ -101,7 +101,7 @@ namespace System.Text.Json
             return creator;
         }
 
-        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableDictionaryCreator`2", "System.Text.Json")]
+        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableDictionaryCreator`2")]
         public override ImmutableCollectionCreator ImmutableDictionaryCreateRange(Type constructingType, Type collectionType, Type elementType)
         {
             Debug.Assert(collectionType.IsGenericType);
index 83aedd1..819dcc2 100644 (file)
@@ -48,7 +48,7 @@ namespace System.Text.Json
             return (Action<TProperty>)addMethod.CreateDelegate(typeof(Action<TProperty>), target);
         }
 
-        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableEnumerableCreator`2", "System.Text.Json")]
+        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableEnumerableCreator`2")]
         public override ImmutableCollectionCreator ImmutableCollectionCreateRange(Type constructingType, Type collectionType, Type elementType)
         {
             MethodInfo createRange = ImmutableCollectionCreateRangeMethod(constructingType, elementType);
@@ -71,7 +71,7 @@ namespace System.Text.Json
             return creator;
         }
 
-        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableDictionaryCreator`2", "System.Text.Json")]
+        [PreserveDependency(".ctor()", "System.Text.Json.ImmutableDictionaryCreator`2")]
         public override ImmutableCollectionCreator ImmutableDictionaryCreateRange(Type constructingType, Type collectionType, Type elementType)
         {
             Debug.Assert(collectionType.IsGenericType);