を分析するのが面倒だ、あなたは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
は他のために有効である必要がありますreturn文、私はあなたがnullを得る危険にあるとは思わないWindowsIdentity
。
よく、私はあなたのためにそれをgoogled: これは私たちの小さな友人のようです: http://youtrack.jetbrains.com/issue/RSRP-328266 – Noich
まさに。上記のアノテーションは328266(つまり、XMLスニペットの最初の行のコメント)を修正することになっていますが、何らかの理由で修正が機能していないようです。 R#の設定や構成に問題がある場合は、詳しく説明してください。 –
私は本当に考えていない:)あなたはそのQAでそれを取る必要があります。 – Noich