From 0700ae601ee1b46157e54c7ba9cde155c703ec1c Mon Sep 17 00:00:00 2001 From: Konstantin Chuvilyov Date: Fri, 11 Sep 2020 12:12:43 +0700 Subject: [PATCH] Namespaces: throw ArgumentException on invalid --namespace --- XmlSchemaClassGenerator/CodeUtilities.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/XmlSchemaClassGenerator/CodeUtilities.cs b/XmlSchemaClassGenerator/CodeUtilities.cs index 8f1ceda2..b46915b1 100644 --- a/XmlSchemaClassGenerator/CodeUtilities.cs +++ b/XmlSchemaClassGenerator/CodeUtilities.cs @@ -365,6 +365,11 @@ internal static string NormalizeNewlines(string text) public static KeyValuePair ParseNamespace(string nsArg, string namespacePrefix) { var parts = nsArg.Split(new[] { '=' }, 2); + if (parts.Length != 2) + { + throw new ArgumentException("XML and C# namespaces should be separated by '='."); + } + var xmlNs = parts[0]; var netNs = parts[1]; var parts2 = xmlNs.Split(new[] { '|' }, 2);