Annotate System.Runtime.Serialization.Primitives for nullable reference types (dotnet...
authorStephen Toub <stoub@microsoft.com>
Tue, 22 Oct 2019 17:48:43 +0000 (13:48 -0400)
committerSantiago Fernandez Madero <safern@microsoft.com>
Tue, 22 Oct 2019 17:48:43 +0000 (10:48 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/bc7a8d93838d23573069fe792aa326d001ec300f

src/libraries/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs
src/libraries/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.csproj
src/libraries/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj
src/libraries/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/CollectionDataContractAttribute.cs
src/libraries/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/ContractNamespaceAttribute.cs
src/libraries/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/DataContractAttribute.cs
src/libraries/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/DataMemberAttribute.cs
src/libraries/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/EnumMemberAttribute.cs
src/libraries/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.cs
src/libraries/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/KnownTypeAttribute.cs

index 54c1a14..9e1943c 100644 (file)
@@ -18,17 +18,17 @@ namespace System.Runtime.Serialization
         public bool IsReference { get { throw null; } set { } }
         public bool IsReferenceSetExplicitly { get { throw null; } }
         public bool IsValueNameSetExplicitly { get { throw null; } }
-        public string ItemName { get { throw null; } set { } }
-        public string KeyName { get { throw null; } set { } }
-        public string Name { get { throw null; } set { } }
-        public string Namespace { get { throw null; } set { } }
-        public string ValueName { get { throw null; } set { } }
+        public string? ItemName { get { throw null; } set { } }
+        public string? KeyName { get { throw null; } set { } }
+        public string? Name { get { throw null; } set { } }
+        public string? Namespace { get { throw null; } set { } }
+        public string? ValueName { get { throw null; } set { } }
     }
     [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module, Inherited=false, AllowMultiple=true)]
     public sealed partial class ContractNamespaceAttribute : System.Attribute
     {
         public ContractNamespaceAttribute(string contractNamespace) { }
-        public string ClrNamespace { get { throw null; } set { } }
+        public string? ClrNamespace { get { throw null; } set { } }
         public string ContractNamespace { get { throw null; } }
     }
     [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
@@ -39,8 +39,8 @@ namespace System.Runtime.Serialization
         public bool IsNamespaceSetExplicitly { get { throw null; } }
         public bool IsReference { get { throw null; } set { } }
         public bool IsReferenceSetExplicitly { get { throw null; } }
-        public string Name { get { throw null; } set { } }
-        public string Namespace { get { throw null; } set { } }
+        public string? Name { get { throw null; } set { } }
+        public string? Namespace { get { throw null; } set { } }
     }
     [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Property, Inherited=false, AllowMultiple=false)]
     public sealed partial class DataMemberAttribute : System.Attribute
@@ -49,7 +49,7 @@ namespace System.Runtime.Serialization
         public bool EmitDefaultValue { get { throw null; } set { } }
         public bool IsNameSetExplicitly { get { throw null; } }
         public bool IsRequired { get { throw null; } set { } }
-        public string Name { get { throw null; } set { } }
+        public string? Name { get { throw null; } set { } }
         public int Order { get { throw null; } set { } }
     }
     [System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false, AllowMultiple=false)]
@@ -57,7 +57,7 @@ namespace System.Runtime.Serialization
     {
         public EnumMemberAttribute() { }
         public bool IsValueSetExplicitly { get { throw null; } }
-        public string Value { get { throw null; } set { } }
+        public string? Value { get { throw null; } set { } }
     }
     [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Property, Inherited=false, AllowMultiple=false)]
     public sealed partial class IgnoreDataMemberAttribute : System.Attribute
@@ -68,8 +68,8 @@ namespace System.Runtime.Serialization
     {
         public InvalidDataContractException() { }
         protected InvalidDataContractException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
-        public InvalidDataContractException(string message) { }
-        public InvalidDataContractException(string message, System.Exception innerException) { }
+        public InvalidDataContractException(string? message) { }
+        public InvalidDataContractException(string? message, System.Exception? innerException) { }
     }
     public partial interface ISerializationSurrogateProvider
     {
@@ -82,7 +82,7 @@ namespace System.Runtime.Serialization
     {
         public KnownTypeAttribute(string methodName) { }
         public KnownTypeAttribute(System.Type type) { }
-        public string MethodName { get { throw null; } }
-        public System.Type Type { get { throw null; } }
+        public string? MethodName { get { throw null; } }
+        public System.Type? Type { get { throw null; } }
     }
 }
index e941f9d..4c34aa1 100644 (file)
@@ -6,6 +6,7 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <FileAlignment>512</FileAlignment>
     <PlatformTarget>AnyCPU</PlatformTarget>
+    <Nullable>enable</Nullable>
     <Configurations>netcoreapp-Debug;netcoreapp-Release</Configurations>
   </PropertyGroup>
   <ItemGroup>
index 720da5d..c8ed3fa 100644 (file)
@@ -7,11 +7,11 @@ namespace System.Runtime.Serialization
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
     public sealed class CollectionDataContractAttribute : Attribute
     {
-        private string _name;
-        private string _ns;
-        private string _itemName;
-        private string _keyName;
-        private string _valueName;
+        private string? _name;
+        private string? _ns;
+        private string? _itemName;
+        private string? _keyName;
+        private string? _valueName;
         private bool _isReference;
         private bool _isNameSetExplicitly;
         private bool _isNamespaceSetExplicitly;
@@ -24,7 +24,7 @@ namespace System.Runtime.Serialization
         {
         }
 
-        public string Namespace
+        public string? Namespace
         {
             get => _ns;
             set
@@ -36,7 +36,7 @@ namespace System.Runtime.Serialization
 
         public bool IsNamespaceSetExplicitly => _isNamespaceSetExplicitly;
 
-        public string Name
+        public string? Name
         {
             get => _name;
             set
@@ -48,7 +48,7 @@ namespace System.Runtime.Serialization
 
         public bool IsNameSetExplicitly => _isNameSetExplicitly;
 
-        public string ItemName
+        public string? ItemName
         {
             get => _itemName;
             set
@@ -60,7 +60,7 @@ namespace System.Runtime.Serialization
 
         public bool IsItemNameSetExplicitly => _isItemNameSetExplicitly;
 
-        public string KeyName
+        public string? KeyName
         {
             get => _keyName;
             set
@@ -84,7 +84,7 @@ namespace System.Runtime.Serialization
 
         public bool IsReferenceSetExplicitly => _isReferenceSetExplicitly;
 
-        public string ValueName
+        public string? ValueName
         {
             get => _valueName;
             set
index c286c80..fba99ef 100644 (file)
@@ -12,7 +12,7 @@ namespace System.Runtime.Serialization
             ContractNamespace = contractNamespace;
         }
 
-        public string ClrNamespace { get; set; }
+        public string? ClrNamespace { get; set; }
 
         public string ContractNamespace { get; }
     }
index e56405e..7cd05c4 100644 (file)
@@ -7,8 +7,8 @@ namespace System.Runtime.Serialization
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)]
     public sealed class DataContractAttribute : Attribute
     {
-        private string _name;
-        private string _ns;
+        private string? _name;
+        private string? _ns;
         private bool _isNameSetExplicitly;
         private bool _isNamespaceSetExplicitly;
         private bool _isReference;
@@ -30,7 +30,7 @@ namespace System.Runtime.Serialization
 
         public bool IsReferenceSetExplicitly => _isReferenceSetExplicitly;
 
-        public string Namespace
+        public string? Namespace
         {
             get => _ns;
             set
@@ -42,7 +42,7 @@ namespace System.Runtime.Serialization
 
         public bool IsNamespaceSetExplicitly => _isNamespaceSetExplicitly;
 
-        public string Name
+        public string? Name
         {
             get => _name;
             set
index c5ccf23..28dadf1 100644 (file)
@@ -7,7 +7,7 @@ namespace System.Runtime.Serialization
     [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
     public sealed class DataMemberAttribute : Attribute
     {
-        private string _name;
+        private string? _name;
         private bool _isNameSetExplicitly;
         private int _order = -1;
 
@@ -15,7 +15,7 @@ namespace System.Runtime.Serialization
         {
         }
 
-        public string Name
+        public string? Name
         {
             get => _name;
             set
index e44e209..989266e 100644 (file)
@@ -7,14 +7,14 @@ namespace System.Runtime.Serialization
     [AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
     public sealed class EnumMemberAttribute : Attribute
     {
-        private string _value;
+        private string? _value;
         private bool _isValueSetExplicitly;
 
         public EnumMemberAttribute()
         {
         }
 
-        public string Value
+        public string? Value
         {
             get => _value;
             set
index 85812d6..2c9618b 100644 (file)
@@ -16,12 +16,12 @@ namespace System.Runtime.Serialization
         {
         }
 
-        public InvalidDataContractException(string message)
+        public InvalidDataContractException(string? message)
             : base(message)
         {
         }
 
-        public InvalidDataContractException(string message, Exception innerException)
+        public InvalidDataContractException(string? message, Exception? innerException)
             : base(message, innerException)
         {
         }
index 0b7a9c0..2dc690a 100644 (file)
@@ -17,8 +17,8 @@ namespace System.Runtime.Serialization
             MethodName = methodName;
         }
 
-        public string MethodName { get; }
+        public string? MethodName { get; }
 
-        public Type Type { get; }
+        public Type? Type { get; }
     }
 }