After running Code Analysis in VS2010 beta (FxCop for previous versions) I’m getting the following warning:
In externally visible method
‘Identity.Identity(WindowsIdentity)’,
validate parameter ‘windowsIdentity’
before using it.
The constructor is:
public Identity(WindowsIdentity windowsIdentity)
: base(windowsIdentity.Token)
{
init();
}
for a class defined as:
public class Identity : WindowsIdentity
My question is, how do I validate the windowsIdentity parameter? Should I validate it in the constructor, and throw an exception, or is there a better way to call this?