Description
For better or worse, controlling behavior using nullable objects is a common place pattern. Checking if an object reference is null should never raise an exception. For example,
object? foo = null;
foo?.DoWork();
// or
if (foo != null)
{
}
Reproduction Steps
Run the following code on Linux.
SecurityIdentifier? securityIdentifier = null;
if (securityIdentifier != null) { }
Expected behavior
(securityIdentifier != null) returns false on Linux and Windows, no exception is raised.
Actual behavior
The following exception is thrown.
System.PlatformNotSupportedException: Windows Principal functionality is not supported on this platform.
at System.Security.Principal.SecurityIdentifier.op_Inequality(SecurityIdentifier left, SecurityIdentifier right)
Regression?
Not sure.
Known Workarounds
No response
Configuration
.net 6.0 linux-x64 self-contained exe
Other information
No response
Description
For better or worse, controlling behavior using nullable objects is a common place pattern. Checking if an object reference is null should never raise an exception. For example,
Reproduction Steps
Run the following code on Linux.
Expected behavior
(securityIdentifier != null) returns false on Linux and Windows, no exception is raised.
Actual behavior
The following exception is thrown.
System.PlatformNotSupportedException: Windows Principal functionality is not supported on this platform.
at System.Security.Principal.SecurityIdentifier.op_Inequality(SecurityIdentifier left, SecurityIdentifier right)
Regression?
Not sure.
Known Workarounds
No response
Configuration
.net 6.0 linux-x64 self-contained exe
Other information
No response