You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PSCredential.Empty.GetNetworkCredential() throws NRE instead of returning null per docs #4696
Exception calling "GetNetworkCredential" with "0" argument(s): "Object reference not set to an instance of an object."
At line:1 char:1
+ [pscredential]::Empty.GetNetworkCredential()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Activity
Don't use PSCredential's operator to cast to NetworkCredential.
iSazonov commentedon Aug 29, 2017
Arnav Singh (@Arnavion) Thanks for your report and repo!
I agree that we should return null in the case.