File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -922,8 +922,6 @@ public string ThreadName
922922 public string UserName =>
923923 m_data . UserName ??= TryGetCurrentUserName ( ) ?? SystemInfo . NotAvailableText ;
924924
925- private static string _cachedWindowsIdentityName ;
926-
927925 private static string TryGetCurrentUserName ( )
928926 {
929927#if ( NETCF || SSCLI || NETSTANDARD1_3 )
@@ -939,13 +937,10 @@ private static string TryGetCurrentUserName()
939937
940938 try
941939 {
942- if ( _cachedWindowsIdentityName is not null )
940+ using ( WindowsIdentity windowsIdentity = WindowsIdentity . GetCurrent ( ) )
943941 {
944- return _cachedWindowsIdentityName ;
942+ return windowsIdentity ? . Name ?? "" ;
945943 }
946-
947- using var windowsIdentity = WindowsIdentity . GetCurrent ( ) ;
948- return _cachedWindowsIdentityName = windowsIdentity ? . Name ?? "" ;
949944 }
950945 catch ( PlatformNotSupportedException )
951946 {
You can’t perform that action at this time.
0 commit comments