11// Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
4- #nullable disable
5-
64using System ;
75using System . Collections . Generic ;
86using System . Globalization ;
@@ -30,7 +28,7 @@ public Manifest(ManifestMetadata metadata)
3028 {
3129 }
3230
33- public Manifest ( ManifestMetadata metadata , ICollection < ManifestFile > files )
31+ public Manifest ( ManifestMetadata metadata , ICollection < ManifestFile > ? files )
3432 {
3533 if ( metadata == null )
3634 {
@@ -105,7 +103,7 @@ public void Save(Stream stream, int minimumManifestVersion, bool generateBackwar
105103 Files . Any ( ) ?
106104 new XElement ( schemaNamespace + "files" ,
107105 Files . Select ( file => new XElement ( schemaNamespace + "file" ,
108- new XAttribute ( "src" , file . Source ) ,
106+ new XAttribute ( "src" , file . Source ! ) ,
109107 file . Target != null ? new XAttribute ( "target" , file . Target ) : null ,
110108 file . Exclude != null ? new XAttribute ( "exclude" , file . Exclude ) : null ) ) ) : null ) ) . Save ( stream ) ;
111109 }
@@ -115,12 +113,12 @@ public static Manifest ReadFrom(Stream stream, bool validateSchema)
115113 return ReadFrom ( stream , null , validateSchema ) ;
116114 }
117115
118- public static Manifest ReadFrom ( Stream stream , Func < string , string > propertyProvider , bool validateSchema )
116+ public static Manifest ReadFrom ( Stream stream , Func < string , string > ? propertyProvider , bool validateSchema )
119117 {
120118 return ReadFrom ( stream , propertyProvider , validateSchema , overrideVersion : null ) ;
121119 }
122120
123- public static Manifest ReadFrom ( Stream stream , Func < string , string > propertyProvider , bool validateSchema , NuGetVersion overrideVersion )
121+ public static Manifest ReadFrom ( Stream stream , Func < string , string > ? propertyProvider , bool validateSchema , NuGetVersion ? overrideVersion )
124122 {
125123 XDocument document ;
126124 if ( propertyProvider == null )
@@ -166,7 +164,7 @@ public static Manifest ReadFrom(Stream stream, Func<string, string> propertyProv
166164 private static string GetSchemaNamespace ( XDocument document )
167165 {
168166 string schemaNamespace = ManifestSchemaUtility . SchemaVersionV1 ;
169- var rootNameSpace = document . Root . Name . Namespace ;
167+ var rootNameSpace = document . Root ! . Name . Namespace ;
170168 if ( rootNameSpace != null && ! String . IsNullOrEmpty ( rootNameSpace . NamespaceName ) )
171169 {
172170 schemaNamespace = rootNameSpace . NamespaceName ;
@@ -227,7 +225,7 @@ private static void CheckSchemaVersion(XDocument document)
227225 }
228226
229227 // Get the package id from the metadata node
230- string packageId = GetPackageId ( metadata ) ;
228+ string ? packageId = GetPackageId ( metadata ) ;
231229
232230 // If the schema of the document doesn't match any of our known schemas
233231 if ( ! ManifestSchemaUtility . IsKnownSchema ( document . Root . Name . Namespace . NamespaceName ) )
@@ -243,7 +241,7 @@ private static void CheckSchemaVersion(XDocument document)
243241 }
244242
245243#if ! IS_CORECLR
246- private static string GetPackageId ( XElement metadataElement )
244+ private static string ? GetPackageId ( XElement metadataElement )
247245 {
248246 XName idName = XName . Get ( "id" , metadataElement . Document . Root . Name . NamespaceName ) ;
249247 XElement element = metadataElement . Element ( idName ) ;
0 commit comments