diff --git a/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs b/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs
index 93b37f4..a26039e 100644
--- a/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs
+++ b/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs
@@ -215,14 +215,24 @@ public void SystemType1_ArrayListToArrayForStruct_Test()
// make sure boxing of struct value type (Guid) is handled properly
// this test was a result of a bug found by a customer.
Guid ret = new Guid();
+
ArrayList guidList = new ArrayList();
guidList.Add(Guid.NewGuid());
guidList.Add(Guid.NewGuid());
+
Guid[] guidArray = (Guid[])guidList.ToArray(typeof(Guid));
+ // Verify the array has the correct length
+ Assert.AreEqual(2, guidArray.Length);
+
+ // Verify each element is not empty and matches the source list
+ int i = 0;
foreach (Guid g in guidArray)
{
+ Assert.IsFalse(Guid.Empty.Equals(g), "Guid should not be empty");
+ Assert.AreEqual(guidList[i], g, "Guid should match the source ArrayList element");
ret = g;
+ i++;
}
}
diff --git a/Tests/NFUnitTestTypes/UnitTestGuid.cs b/Tests/NFUnitTestTypes/UnitTestGuid.cs
index f9ed9c3..886207c 100644
--- a/Tests/NFUnitTestTypes/UnitTestGuid.cs
+++ b/Tests/NFUnitTestTypes/UnitTestGuid.cs
@@ -99,7 +99,7 @@ public void Guid_TryParseGuidWithDashes_Valid()
{
var g1 = Guid.NewGuid();
var str = g1.ToString();
- bool parsed = Guid.TryParseGuidWithDashes(str, out var g2);
+ bool parsed = Guid.TryParse(str, out var g2);
Assert.IsTrue(parsed);
Assert.AreEqual(g1, g2);
}
@@ -107,7 +107,7 @@ public void Guid_TryParseGuidWithDashes_Valid()
[TestMethod]
public void Guid_TryParseGuidWithDashes_Invalid()
{
- bool parsed = Guid.TryParseGuidWithDashes("invalid-guid", out var g2);
+ bool parsed = Guid.TryParse("invalid-guid", out var g2);
Assert.IsFalse(parsed);
Assert.AreEqual(Guid.Empty, g2);
}
diff --git a/nanoFramework.CoreLibrary/System/Guid.cs b/nanoFramework.CoreLibrary/System/Guid.cs
index 3fbbf3a..dece99d 100644
--- a/nanoFramework.CoreLibrary/System/Guid.cs
+++ b/nanoFramework.CoreLibrary/System/Guid.cs
@@ -11,19 +11,13 @@ namespace System
[Serializable]
public struct Guid
{
- private int[] _data;
+ private int[] _data = new int[4];
///
/// A read-only instance of the Guid class which consists of all zeros.
///
public static readonly Guid Empty = new Guid(new byte[16]);
- public Guid()
- {
- // All zeros
- _data = new int[4];
- }
-
///
/// Initializes a new instance of the structure by using the specified integers and bytes.
///