New PhysicalAddress.TryParse methods taking span and string#1057
New PhysicalAddress.TryParse methods taking span and string#1057alnikola merged 5 commits intodotnet:masterfrom
Conversation
New PhysicalAddress.Parse overload taking span
...libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/PhysicalAddress.cs
Outdated
Show resolved
Hide resolved
|
/azp run runtime-libraries outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
scalablecory
left a comment
There was a problem hiding this comment.
Looks good other than this one thing.
...libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/PhysicalAddress.cs
Outdated
Show resolved
Hide resolved
...libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/PhysicalAddress.cs
Outdated
Show resolved
Hide resolved
...libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/PhysicalAddress.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/PhysicalAddressTest.cs
Outdated
Show resolved
Hide resolved
- TryParseInternal removed
|
/azp run runtime-libraries outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
|
|
||
| public static PhysicalAddress Parse(string address) | ||
| public static PhysicalAddress Parse(string address) => address != null ? Parse(address.AsSpan()) : None; |
There was a problem hiding this comment.
It seems before the PR Parse(null) throw.
For string.Empty we throw too so we could use implicit conversion string->ReadOnlySpan
public static PhysicalAddress Parse(string address) => Parse(address);There was a problem hiding this comment.
It seems before the PR Parse(null) throw.
No, it returned None:
https://github.com/dotnet/runtime/pull/1057/files#diff-74838e07dff5967e2e1173264255be64L112-L115
There was a problem hiding this comment.
I don't know what PowerShell is passing there, but passing in null returns None.
using System;
using System.Net.NetworkInformation;
class Program
{
static void Main()
{
Console.WriteLine(PhysicalAddress.Parse(null) == PhysicalAddress.None);
}
}
outputs:
True
That's the case for .NET Framework as well.
There was a problem hiding this comment.
@stephentoub Thanks! I will open new issue in PowerShell repo.
|
@alnikola, you merged this with a bunch of failures due to this PR that are causing stack overflow exceptions. |
|
Sorry for the mistake I was confused by the CI run results. It reported 73 successful checks out of 83 which made me to believe that the code is fine since I didn't do anything platform specific. |
|
The build legs and the test legs are separate. Lots of build legs succeeded, but the legs that actually ran the tests failed. |

This PR introduces two new PhysicalAddress.TryParse methods taking span and string as well as adds an PhysicalAddress.Parse overload taking span.
Fixes dotnet/corefx#29780