ILSpy का उपयोग करते हुए टुकड़े करना आलसी हूँ, आप GetCurrent
और GetCurrentInternal
की एक de-संकलित संस्करण है, जो GetCurrent
कॉल देख सकते हैं । परिणाम है:
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));
}
threadOnly
के बाद से हमेशा गलत जब GetCurrent
से फोन कर रहा है, और currentToken
अन्य के लिए वैध होना चाहिए है वापसी विवरण, मुझे नहीं लगता कि आपको शून्यप्राप्त करने का खतरा है।
अच्छी तरह से, मैंने इसे आपके लिए googled :) यह हमारा छोटा मित्र लगता है: http://youtrack.jetbrains.com/issue/RSRP-328266 – Noich
बिल्कुल।उपर्युक्त एनोटेशन 328266 को ठीक करना है (इसलिए एक्सएमएल स्निपेट की पहली पंक्ति पर टिप्पणी), लेकिन किसी भी कारण से, फिक्स काम नहीं कर रहा है। यदि यह मेरी आर # सेटिंग्स या कॉन्फ़िगरेशन में कोई समस्या इंगित करता है, तो कृपया विस्तृत करें। –
मुझे वास्तव में कोई जानकारी नहीं है :) आपको इसे अपने क्यूए के साथ ले जाना होगा। – Noich