使用ILSpy,你可以看看GetCurrent
和GetCurrentInternal
去編譯版本,其中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
必須爲其它有效始終是假的返回聲明,我不認爲你有風險收到null WindowsIdentity
。
好吧,我爲你搜索它:) 這似乎是我們的小朋友: http://youtrack.jetbrains.com/issue/RSRP-328266 – Noich
沒錯。上面的註釋應該修復328266(因此對XML片段的第一行進行註釋),但無論出於何種原因,修復似乎都不起作用。 如果這表明我的R#設置或配置有問題,請詳細說明。 –
我真的不知道:)你將不得不把它與他們的質量保證。 – Noich