{"action":"created","issue":{"url":"https://api.github.com/repos/twcclegg/libphonenumber-csharp/issues/78","repository_url":"https://api.github.com/repos/twcclegg/libphonenumber-csharp","labels_url":"https://api.github.com/repos/twcclegg/libphonenumber-csharp/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/twcclegg/libphonenumber-csharp/issues/78/comments","events_url":"https://api.github.com/repos/twcclegg/libphonenumber-csharp/issues/78/events","html_url":"https://github.com/twcclegg/libphonenumber-csharp/issues/78","id":369129671,"node_id":"MDU6SXNzdWUzNjkxMjk2NzE=","number":78,"title":".NET 3.5 Version 8.9.15 requires external PhoneNumberMetaData.xml","user":{"login":"athoik","id":2682247,"node_id":"MDQ6VXNlcjI2ODIyNDc=","avatar_url":"https://avatars3.githubusercontent.com/u/2682247?v=4","gravatar_id":"","url":"https://api.github.com/users/athoik","html_url":"https://github.com/athoik","followers_url":"https://api.github.com/users/athoik/followers","following_url":"https://api.github.com/users/athoik/following{/other_user}","gists_url":"https://api.github.com/users/athoik/gists{/gist_id}","starred_url":"https://api.github.com/users/athoik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/athoik/subscriptions","organizations_url":"https://api.github.com/users/athoik/orgs","repos_url":"https://api.github.com/users/athoik/repos","events_url":"https://api.github.com/users/athoik/events{/privacy}","received_events_url":"https://api.github.com/users/athoik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-10-11T13:47:17Z","updated_at":"2018-10-16T11:06:32Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\n\r\nI just updated an old project to a newer version 8.9.15 from 7.5.1.\r\n\r\nCurrently the PhoneNumberUtil.GetInstance() fails with error `Could not find file 'C:\\...\\bin\\Debug\\PhoneNumbers.PhoneNumberMetaData.xml'`.\r\n\r\nSo it's now mandatory to place the [PhoneNumberMetaData.xml](https://github.com/googlei18n/libphonenumber/blob/master/resources/PhoneNumberMetadata.xml) in the output folder?\r\n\r\nI though that metadata was embedded in the dll.\r\n\r\nMaybe [example](https://github.com/twcclegg/libphonenumber-csharp#example) should be updated if xml is not embedded any more?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/twcclegg/libphonenumber-csharp/issues/comments/430196036","html_url":"https://github.com/twcclegg/libphonenumber-csharp/issues/78#issuecomment-430196036","issue_url":"https://api.github.com/repos/twcclegg/libphonenumber-csharp/issues/78","id":430196036,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDE5NjAzNg==","user":{"login":"neuroid","id":202341,"node_id":"MDQ6VXNlcjIwMjM0MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/202341?v=4","gravatar_id":"","url":"https://api.github.com/users/neuroid","html_url":"https://github.com/neuroid","followers_url":"https://api.github.com/users/neuroid/followers","following_url":"https://api.github.com/users/neuroid/following{/other_user}","gists_url":"https://api.github.com/users/neuroid/gists{/gist_id}","starred_url":"https://api.github.com/users/neuroid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neuroid/subscriptions","organizations_url":"https://api.github.com/users/neuroid/orgs","repos_url":"https://api.github.com/users/neuroid/repos","events_url":"https://api.github.com/users/neuroid/events{/privacy}","received_events_url":"https://api.github.com/users/neuroid/received_events","type":"User","site_admin":false},"created_at":"2018-10-16T11:06:32Z","updated_at":"2018-10-16T11:06:32Z","author_association":"CONTRIBUTOR","body":"@athoik, could you try this patch?\r\n\r\n```diff\r\ndiff --git a/csharp/PhoneNumbers/BuildMetadataFromXml.cs b/csharp/PhoneNumbers/BuildMetadataFromXml.cs\r\nindex f4e8a82a..69dcbf69 100644\r\n--- a/csharp/PhoneNumbers/BuildMetadataFromXml.cs\r\n+++ b/csharp/PhoneNumbers/BuildMetadataFromXml.cs\r\n@@ -20,6 +20,9 @@ using System.IO;\r\n using System.Linq;\r\n using System.Reflection;\r\n using System.Text.RegularExpressions;\r\n+#if NET35\r\n+using System.Xml;\r\n+#endif\r\n using System.Xml.Linq;\r\n\r\n namespace PhoneNumbers\r\n@@ -80,19 +83,20 @@ namespace PhoneNumbers\r\n             bool isAlternateFormatsMetadata)\r\n         {\r\n             XDocument document;\r\n-#if NET35\r\n-            document = XDocument.Load(name);\r\n-#else\r\n-#if  NET40\r\n+\r\n+#if  NET40 || NET35\r\n             var asm = Assembly.GetExecutingAssembly();\r\n #else\r\n             var asm = typeof(PhoneNumberUtil).GetTypeInfo().Assembly;\r\n #endif\r\n             using (var input = asm.GetManifestResourceStream(name))\r\n-            {\r\n+            {\r\n+#if NET35\r\n+                document = XDocument.Load(new XmlTextReader(input));\r\n+#else\r\n                 document = XDocument.Load(input);\r\n-            }\r\n #endif\r\n+            }\r\n\r\n             var metadataCollection = new PhoneMetadataCollection.Builder();\r\n             var metadataFilter = GetMetadataFilter(liteBuild, specialBuild);\r\n```\r\n\r\nThis fixes the issue for me and compiles for all runtimes."}}
{"actor":{"display_login":"neuroid"}}