private static void ValidateManifestSchema(XDocument document, string schemaNamespace) { #if !IS_CORECLR // CORECLR_TODO: XmlSchema var schemaSet = ManifestSchemaUtility.GetManifestSchemaSet(schemaNamespace); document.Validate(schemaSet, (sender, e) => { if (e.Severity == XmlSeverityType.Error) { var message = e.Message; // To make sure this error message is actionable, try to add the element name // where the error is occurring. var senderElement = sender as XElement; if (senderElement != null) { message = string.Format( CultureInfo.CurrentCulture, Strings.InvalidNuspecElement, message, senderElement.Name.LocalName); } // Throw an exception if there is a validation error throw new InvalidOperationException(message); } }); #endif }
private static void ValidateManifestSchema(XDocument document, string schemaNamespace) { #if !IS_CORECLR // CORECLR_TODO: XmlSchema var schemaSet = ManifestSchemaUtility.GetManifestSchemaSet(schemaNamespace); document.Validate(schemaSet, (sender, e) => { if (e.Severity == XmlSeverityType.Error) { // Throw an exception if there is a validation error throw new InvalidOperationException(e.Message); } }); #endif }