Korzystanie ILSpy, można spojrzeć na de-kompilowany wersją GetCurrent
i GetCurrentInternal
, co GetCurrent
połączeń . Wynikiem jest:
GetCurrent:
public static WindowsIdentity GetCurrent()
{
return WindowsIdentity.GetCurrentInternal(TokenAccessLevels.MaximumAllowed, false);
}
GetCurrentInternal:
internal static WindowsIdentity GetCurrentInternal(TokenAccessLevels desiredAccess, bool threadOnly)
{
int errorCode = 0;
bool flag;
SafeTokenHandle currentToken = WindowsIdentity.GetCurrentToken(desiredAccess, threadOnly, out flag, out errorCode);
if (currentToken != null && !currentToken.IsInvalid)
{
WindowsIdentity windowsIdentity = new WindowsIdentity();
windowsIdentity.m_safeTokenHandle.Dispose();
windowsIdentity.m_safeTokenHandle = currentToken;
return windowsIdentity;
}
if (threadOnly && !flag)
{
return null;
}
throw new SecurityException(Win32Native.GetMessage(errorCode));
}
Od threadOnly
jest zawsze fałszywe Dzwoniąc z GetCurrent
i currentToken
musi być ważny dla innych return statement, nie sądzę, że jesteś narażony na ryzyko utraty wartości WindowsIdentity
.
cóż, szukałem go dla Ciebie :) To wydaje się być naszym małym przyjacielem: http://youtrack.jetbrains.com/issue/RSRP-328266 – Noich
Dokładnie.Powyższe adnotacje mają naprawić 328266 (stąd komentarz w pierwszym wierszu fragmentu XML), ale z jakiegoś powodu poprawka nie działa. Jeśli to wskazuje na problem w moich ustawieniach lub konfiguracji R #, proszę opracuj. –
Naprawdę nie mam pojęcia :) Musisz to zrobić ze swoją kontrolą jakości. – Noich