使用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