diff --git a/Diwen.Xbrl/ArgumentNullException.cs b/Diwen.Xbrl/ArgumentNullException.cs
new file mode 100644
index 0000000..07b395c
--- /dev/null
+++ b/Diwen.Xbrl/ArgumentNullException.cs
@@ -0,0 +1,25 @@
+#if NETSTANDARD2_0
+
+using System.Runtime.CompilerServices;
+
+namespace Diwen.Compat;
+
+///
+/// Polyfill for the ArgumentNullException factory method from net6.0+
+///
+public static class ArgumentNullException
+{
+ /// Throws an if is .
+ /// The reference type argument to validate as non-null.
+ /// The name of the parameter with which corresponds.
+ ///
+ /// is .
+ public static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
+ {
+ if (argument is null)
+ {
+ throw new System.ArgumentNullException(paramName);
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/Diwen.Xbrl/Csv/Report.cs b/Diwen.Xbrl/Csv/Report.cs
index 2680ddf..ae41438 100644
--- a/Diwen.Xbrl/Csv/Report.cs
+++ b/Diwen.Xbrl/Csv/Report.cs
@@ -12,6 +12,9 @@
using Diwen.Xbrl.Csv.Taxonomy;
using Diwen.Xbrl.Extensions;
using Diwen.Xbrl.Xml;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
public partial class Report
diff --git a/Diwen.Xbrl/Diwen.Xbrl.csproj b/Diwen.Xbrl/Diwen.Xbrl.csproj
index fd3d152..e83e3a2 100644
--- a/Diwen.Xbrl/Diwen.Xbrl.csproj
+++ b/Diwen.Xbrl/Diwen.Xbrl.csproj
@@ -1,6 +1,7 @@
- net8.0
+ netstandard2.0;net8.0
+ latest
3.4.1
@@ -21,6 +22,14 @@
true
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
public static class XmlQualifiedNameExtensions
diff --git a/Diwen.Xbrl/Inline/InlineXbrl.cs b/Diwen.Xbrl/Inline/InlineXbrl.cs
index 19b3476..65240a7 100644
--- a/Diwen.Xbrl/Inline/InlineXbrl.cs
+++ b/Diwen.Xbrl/Inline/InlineXbrl.cs
@@ -94,7 +94,7 @@ public static void ParseFacts(XDocument document, Report report)
if (!string.IsNullOrWhiteSpace(scale))
{
var power = int.Parse(scale);
- var v = decimal.Parse(value.Replace(" ", ""));
+ var v = decimal.Parse(value.Replace(" ", ""), CultureInfo.InvariantCulture);
var multiplier = (decimal)Math.Pow(10, power);
v *= multiplier;
value = v.ToString();
diff --git a/Diwen.Xbrl/Json/Report.cs b/Diwen.Xbrl/Json/Report.cs
index 3b718c5..ba4a474 100644
--- a/Diwen.Xbrl/Json/Report.cs
+++ b/Diwen.Xbrl/Json/Report.cs
@@ -158,7 +158,7 @@ public static Xml.Report ToXbrlXml(Report report, Dictionary dim
context.Period = period;
var metric = fact.Dimensions["concept"].Split(':').Last();
- var unitValue = fact.Dimensions.GetValueOrDefault("unit");
+ var unitValue = fact.Dimensions.GetValueOrDefault("unit", null);
string unitRef = null;
if (unitValue != null)
{
diff --git a/Diwen.Xbrl/Xml/ContextCollection.cs b/Diwen.Xbrl/Xml/ContextCollection.cs
index 5e921f4..6b48743 100644
--- a/Diwen.Xbrl/Xml/ContextCollection.cs
+++ b/Diwen.Xbrl/Xml/ContextCollection.cs
@@ -26,6 +26,9 @@ namespace Diwen.Xbrl.Xml
using System.Collections.ObjectModel;
using System.Globalization;
using Diwen.Xbrl.Extensions;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
public class ContextCollection : KeyedCollection, IEquatable>
diff --git a/Diwen.Xbrl/Xml/ExplicitMember.cs b/Diwen.Xbrl/Xml/ExplicitMember.cs
index 981d8fe..93e910a 100644
--- a/Diwen.Xbrl/Xml/ExplicitMember.cs
+++ b/Diwen.Xbrl/Xml/ExplicitMember.cs
@@ -27,6 +27,9 @@ namespace Diwen.Xbrl.Xml
using System.Xml.Schema;
using System.Xml.Serialization;
using Diwen.Xbrl.Extensions;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
[XmlRoot(ElementName = "explicitMember", Namespace = "http://xbrl.org/2006/xbrldi")]
diff --git a/Diwen.Xbrl/Xml/Fact.cs b/Diwen.Xbrl/Xml/Fact.cs
index f0b9637..603c478 100644
--- a/Diwen.Xbrl/Xml/Fact.cs
+++ b/Diwen.Xbrl/Xml/Fact.cs
@@ -26,6 +26,9 @@ namespace Diwen.Xbrl.Xml
using System.Xml;
using System.Xml.Serialization;
using Diwen.Xbrl.Extensions;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
public class Fact : IEquatable
diff --git a/Diwen.Xbrl/Xml/FilingIndicator.cs b/Diwen.Xbrl/Xml/FilingIndicator.cs
index 9a10876..23a6680 100644
--- a/Diwen.Xbrl/Xml/FilingIndicator.cs
+++ b/Diwen.Xbrl/Xml/FilingIndicator.cs
@@ -25,6 +25,9 @@ namespace Diwen.Xbrl.Xml
using System.Diagnostics;
using System.Xml.Schema;
using System.Xml.Serialization;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
[DebuggerDisplay("{Value} : {Filed}")]
diff --git a/Diwen.Xbrl/Xml/Report.cs b/Diwen.Xbrl/Xml/Report.cs
index e03ded6..c8346cc 100644
--- a/Diwen.Xbrl/Xml/Report.cs
+++ b/Diwen.Xbrl/Xml/Report.cs
@@ -31,6 +31,9 @@ namespace Diwen.Xbrl.Xml
using System.Xml;
using System.Xml.Serialization;
using Diwen.Xbrl.Extensions;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
[Serializable]
@@ -114,7 +117,7 @@ public Entity Entity
[XmlIgnore]
public SchemaReference SchemaReference
{
- get => SchemaReferences?.FirstOrDefault(new SchemaReference());
+ get => SchemaReferences?.FirstOrDefault() ?? new SchemaReference();
set => SchemaReferences = [value];
}
diff --git a/Diwen.Xbrl/Xml/TypedMember.cs b/Diwen.Xbrl/Xml/TypedMember.cs
index 58ef780..269fdd9 100644
--- a/Diwen.Xbrl/Xml/TypedMember.cs
+++ b/Diwen.Xbrl/Xml/TypedMember.cs
@@ -26,6 +26,9 @@ namespace Diwen.Xbrl.Xml
using System.Xml.Schema;
using System.Xml.Serialization;
using Diwen.Xbrl.Extensions;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
[XmlRoot(ElementName = "typedMember", Namespace = "http://xbrl.org/2006/xbrldi")]
diff --git a/Diwen.Xbrl/Xml/TypedMemberCollection.cs b/Diwen.Xbrl/Xml/TypedMemberCollection.cs
index 9ce9eb3..269f3ab 100644
--- a/Diwen.Xbrl/Xml/TypedMemberCollection.cs
+++ b/Diwen.Xbrl/Xml/TypedMemberCollection.cs
@@ -28,6 +28,9 @@ namespace Diwen.Xbrl.Xml
using System.Xml;
using System.Xml.Serialization;
using Diwen.Xbrl.Extensions;
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
///
public class TypedMemberCollection : Collection, IEquatable>
diff --git a/Diwen.Xbrl/Xml/Unit.cs b/Diwen.Xbrl/Xml/Unit.cs
index 1cc49eb..6553a41 100644
--- a/Diwen.Xbrl/Xml/Unit.cs
+++ b/Diwen.Xbrl/Xml/Unit.cs
@@ -27,7 +27,10 @@ namespace Diwen.Xbrl.Xml
using System.Xml.Schema;
using System.Xml.Serialization;
using Diwen.Xbrl.Extensions;
-
+#if NETSTANDARD2_0
+ using ArgumentNullException = Compat.ArgumentNullException;
+#endif
+
///
[DebuggerDisplay("{Id}")]
[Serializable]