Skip to content

Commit

Permalink
Merge branch 'mvaneijken-master' into v2022-0920
Browse files Browse the repository at this point in the history
  • Loading branch information
sorengranfeldt committed Sep 20, 2022
2 parents 73b4157 + 9b74b0b commit c0066ca
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Granfeldt.SQL.MA/SqlMethods/SqlMethods.Impersonation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,20 @@ void ShowIdentity()
{
foreach (IdentityReference group in currentIdentity.Groups)
{
NTAccount account = group.Translate(typeof(NTAccount)) as NTAccount;
Tracer.TraceInformation("group-membership {0}", account.Value);
try
{
NTAccount account = group.Translate(typeof(NTAccount)) as NTAccount;
Tracer.TraceInformation("group-membership {0}", account.Value);
}
catch (Exception ex)
{
/*
* If the SID cannot be resolved, log the SID, but don't throw the exception.
* Throwing the exception kills the run profile, where the membership might be totally
* irrelevant. We do log the SID for diagnostic purpose.
*/
Tracer.TraceError($"error-resolving-current-group-name: {group.Value}", ex);
}
}
}
}
Expand Down

0 comments on commit c0066ca

Please sign in to comment.