Comments (16)
Metadata is embedded for other versions. .NET 3.5 support was briefly removed to support netstandard. I will take a look.
from libphonenumber-csharp.
Hi @neuroid,
Yes, your approach seems right, the XmlTextReader supports stream input.
Let's see if we finally made it!
from libphonenumber-csharp.
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.
I am using the nuget package.
from libphonenumber-csharp.
@neuroid don't suppose you have seen this?
from libphonenumber-csharp.
Nope. But, I'm still on 8.9.3 in my project. I'll check the latest version tomorrow.
from libphonenumber-csharp.
8.9.8 is the first version that issue appears.
from libphonenumber-csharp.
@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.
It doesn't fix the issue, still getting the same error when creating instance.
from libphonenumber-csharp.
@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.
@twcclegg , I created a PR #80. I'll check the result from CI and let you know.
from libphonenumber-csharp.
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.
@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.
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.
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.
Fix release in v8.9.16.
from libphonenumber-csharp.
Related Issues (20)
- How to parse without getting exception for wrong format? HOT 10
- Country Code is added to NationalNumber in PhoneNumber Object if Number is too short HOT 1
- Could not load file or assembly 'System.IO.Compression HOT 6
- Document how changes in Google's base library are included or not HOT 2
- Strong named assemblies HOT 2
- Make metadata update and publish new version fully automatically HOT 1
- New Kazakhstan country code. HOT 1
- Could not interpret numbers after plus-sign when parsing +00000000000000 HOT 3
- Missing or invalid default region. HOT 2
- IsPossibleNumberForTypeWithReason returns valid mobile when IsValidNumber returns invalid HOT 1
- Valid US number is resulting in IsValid to false HOT 4
- Parsing phone number as valid when it starts with _ HOT 9
- GetNumberType always returns UNKNOWN HOT 2
- Breaking change in PhoneNumberUtil.Normalize HOT 2
- Enable nullable reference types
- American phone not correctly parsed? HOT 2
- Version 8.13.26 causes IndexOutOfRangeException HOT 3
- Vietnamese phone number does not validate HOT 1
- French mobile numbers with prefix "07" are not detected as mobile numbers HOT 2
- docs: codecov badge on README leads to old trunk branch "master" instead of the new "main" branch HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libphonenumber-csharp.