diff --git a/.github/workflows/securitycodescan.yml b/.github/workflows/securitycodescan.yml
index 37b1e71..76f089f 100644
--- a/.github/workflows/securitycodescan.yml
+++ b/.github/workflows/securitycodescan.yml
@@ -16,7 +16,10 @@ on:
branches: [ "master" ]
schedule:
- cron: '35 15 * * 1'
-
+
+env:
+ DOTNET_ROLL_FORWARD: Major
+
jobs:
SCS:
runs-on: windows-latest
diff --git a/src/System.Net.IPNetwork/IPNetwork2.cs b/src/System.Net.IPNetwork/IPNetwork2.cs
index e1b8854..9e5b867 100644
--- a/src/System.Net.IPNetwork/IPNetwork2.cs
+++ b/src/System.Net.IPNetwork/IPNetwork2.cs
@@ -624,6 +624,17 @@ private static void InternalParse(bool tryParse, string network, ICidrGuess cidr
string[] args = network.Split(new char[] { ' ', '/' }, splitOptions);
byte cidr = 0;
+ if (args.Length == 0)
+ {
+ if (tryParse == false)
+ {
+ throw new ArgumentNullException("network");
+ }
+
+ ipnetwork = null;
+ return;
+ }
+
if (args.Length == 1)
{
string cidrlessNetwork = args[0];
diff --git a/src/System.Net.IPNetwork/IPNetworkCollection.cs b/src/System.Net.IPNetwork/IPNetworkCollection.cs
index ea9f570..e694832 100644
--- a/src/System.Net.IPNetwork/IPNetworkCollection.cs
+++ b/src/System.Net.IPNetwork/IPNetworkCollection.cs
@@ -8,6 +8,9 @@ namespace System.Net
using System.Collections.Generic;
using System.Numerics;
+ ///
+ /// A collection of IPNetwork2
+ ///
public class IPNetworkCollection : IEnumerable, IEnumerator
{
private BigInteger _enumerator;
@@ -59,6 +62,9 @@ private BigInteger _network
#region Count, Array, Enumerator
+ ///
+ /// Count the nnumber of IPAddresses in a IPNetworkCollection
+ ///
public BigInteger Count
{
get
@@ -102,6 +108,9 @@ IEnumerator IEnumerable.GetEnumerator()
#region IEnumerator Members
+ ///
+ /// Gets the current IEnumerator item
+ ///
public IPNetwork2 Current
{
get { return this[this._enumerator]; }
@@ -111,6 +120,9 @@ public IPNetwork2 Current
#region IDisposable Members
+ ///
+ /// Dispose the IPNetwork instance
+ ///
public void Dispose()
{
// nothing to dispose
@@ -120,12 +132,18 @@ public void Dispose()
#endregion
#region IEnumerator Members
-
+ ///
+ /// Gets the element in the collection at the current position of the enumerator.
+ ///
object IEnumerator.Current
{
get { return this.Current; }
}
+ ///
+ /// Advances the enumerator to the next element of the collection.
+ ///
+ /// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
public bool MoveNext()
{
this._enumerator++;
@@ -137,6 +155,9 @@ public bool MoveNext()
return true;
}
+ ///
+ /// Sets the enumerator to its initial position, which is before the first element in the collection.
+ ///
public void Reset()
{
this._enumerator = -1;
diff --git a/src/TestProject/TryParseUnitTest.cs b/src/TestProject/TryParseUnitTest.cs
index f7d5772..77a2595 100644
--- a/src/TestProject/TryParseUnitTest.cs
+++ b/src/TestProject/TryParseUnitTest.cs
@@ -333,5 +333,15 @@ public void Test_IPAddress_TryParse(string ipaddress, bool parsed)
}
#endregion
+
+ #region Issue294
+
+ [TestMethod]
+ public void Test_IPNetwork_TryParse_Issue294()
+ {
+ bool result = IPNetwork2.TryParse("*", out IPNetwork2 ipaddress1);
+ Assert.AreEqual(false, result, "parsed1");
+ }
+ #endregion
}
}