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
ArgumentException for initializing SecurityIdentifier for WellKnownSidType.LogonIdsSid or WellKnownSidType.WinLocalLogonSid in .Net6 #1419
Here is my reproduce code on .Net6, any suggestions?
using System;
using System.Security.Principal;
namespace ConsoleApp45
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("New param");
var param = new SecurityIdentifier("S-1-5-21-198055498-3910363945-93989812");
SecurityIdentifier sid;
Console.WriteLine("New sid");
foreach (WellKnownSidType type in Enum.GetValues(typeof(WellKnownSidType)))
{
if (type == WellKnownSidType.LogonIdsSid || type == WellKnownSidType.WinLocalLogonSid)
{
// these types can't be created, skip
continue;
}
try
{
sid = new SecurityIdentifier(type, param);
Console.WriteLine(type.ToString());
}
catch (ArgumentException)
{
Console.WriteLine($"The error type is: {type}");
}
}
}
}
Activity