Git Product home page Git Product logo

Comments (16)

twcclegg avatar twcclegg commented on July 28, 2024 1

Metadata is embedded for other versions. .NET 3.5 support was briefly removed to support netstandard. I will take a look.

from libphonenumber-csharp.

athoik avatar athoik commented on July 28, 2024 1

Hi @neuroid,

Yes, your approach seems right, the XmlTextReader supports stream input.

Let's see if we finally made it!

from libphonenumber-csharp.

twcclegg avatar twcclegg commented on July 28, 2024

Are you having this issue with the nuget package or using the source code? It is published as Release rather than Debug.

from libphonenumber-csharp.

athoik avatar athoik commented on July 28, 2024

I am using the nuget package.

from libphonenumber-csharp.

twcclegg avatar twcclegg commented on July 28, 2024

@neuroid don't suppose you have seen this?

from libphonenumber-csharp.

neuroid avatar neuroid commented on July 28, 2024

Nope. But, I'm still on 8.9.3 in my project. I'll check the latest version tomorrow.

from libphonenumber-csharp.

athoik avatar athoik commented on July 28, 2024

8.9.8 is the first version that issue appears.

from libphonenumber-csharp.

twcclegg avatar twcclegg commented on July 28, 2024

@athoik Can you try https://ci.appveyor.com/api/buildjobs/hfoou3xgdxyrdbjt/artifacts/csharp%2FPhoneNumbers%2Fbin%2FRelease%2Flibphonenumber-csharp.8.9.15-040b0d0.nupkg?

from libphonenumber-csharp.

athoik avatar athoik commented on July 28, 2024

It doesn't fix the issue, still getting the same error when creating instance.

from libphonenumber-csharp.

athoik avatar athoik commented on July 28, 2024

@twcclegg, I just a quick look on the code, currently if NET35 we are not trying to load embedded XML at all.

Maybe something like that will do it?

--- a/csharp/PhoneNumbers/BuildMetadataFromXml.cs
+++ b/csharp/PhoneNumbers/BuildMetadataFromXml.cs
@@ -80,10 +80,7 @@ namespace PhoneNumbers
             bool isAlternateFormatsMetadata)
         {
             XDocument document;
-#if NET35
-            document = XDocument.Load(name);
-#else
-#if  NET40
+#if (NET35 || NET40)
             var asm = Assembly.GetExecutingAssembly();
 #else
             var asm = typeof(PhoneNumberUtil).GetTypeInfo().Assembly;

from libphonenumber-csharp.

athoik avatar athoik commented on July 28, 2024

@twcclegg , I created a PR #80. I'll check the result from CI and let you know.

from libphonenumber-csharp.

neuroid avatar neuroid commented on July 28, 2024

Sorry for the delay but I finally managed to test this. 8.9.7 is the last version that is working for me. Looking at the changes in 8.9.8, @athoik's PR seems to be a step in the right direction (although, the CI build failed so this needs more work).

from libphonenumber-csharp.

neuroid avatar neuroid commented on July 28, 2024

@athoik, could you try this patch?

diff --git a/csharp/PhoneNumbers/BuildMetadataFromXml.cs b/csharp/PhoneNumbers/BuildMetadataFromXml.cs
index f4e8a82a..69dcbf69 100644
--- a/csharp/PhoneNumbers/BuildMetadataFromXml.cs
+++ b/csharp/PhoneNumbers/BuildMetadataFromXml.cs
@@ -20,6 +20,9 @@ using System.IO;
 using System.Linq;
 using System.Reflection;
 using System.Text.RegularExpressions;
+#if NET35
+using System.Xml;
+#endif
 using System.Xml.Linq;

 namespace PhoneNumbers
@@ -80,19 +83,20 @@ namespace PhoneNumbers
             bool isAlternateFormatsMetadata)
         {
             XDocument document;
-#if NET35
-            document = XDocument.Load(name);
-#else
-#if  NET40
+
+#if  NET40 || NET35
             var asm = Assembly.GetExecutingAssembly();
 #else
             var asm = typeof(PhoneNumberUtil).GetTypeInfo().Assembly;
 #endif
             using (var input = asm.GetManifestResourceStream(name))
-            {
+            {
+#if NET35
+                document = XDocument.Load(new XmlTextReader(input));
+#else
                 document = XDocument.Load(input);
-            }
 #endif
+            }

             var metadataCollection = new PhoneMetadataCollection.Builder();
             var metadataFilter = GetMetadataFilter(liteBuild, specialBuild);

This fixes the issue for me and compiles for all runtimes.

from libphonenumber-csharp.

athoik avatar athoik commented on July 28, 2024

Yes, we did 👍

CI build worked, testing the produced dll and there is no exception any more on .NET 3.5

In case you like to commit my trial and error attempts, please consider "squash and merge".

Thanks!

from libphonenumber-csharp.

twcclegg avatar twcclegg commented on July 28, 2024

See where things got broken I'll merge #80 and release it with 8.9.16, date for that depends on Google's release but I would guess the next couple days

from libphonenumber-csharp.

twcclegg avatar twcclegg commented on July 28, 2024

Fix release in v8.9.16.

from libphonenumber-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.