can WindowsIdentity.GetCurrent() return null?
ReSharper warns me about a possible NullReferenceException in WindowsIdentity windowsIdentity = new WindowsIdentity(WindowsIdentity.GetCurrent().Token); I looked in MSDN doc but didn't see any mention of this. Also, it doesn't make sense since if you run an executable, you have to be logged on. Is this just a ReSharper search pattern? nitzanms Using ILSpy, you can look at a de-compiled version of GetCurrent and GetCurrentInternal , which GetCurrent calls. The result is: GetCurrent: public static WindowsIdentity GetCurrent() { return WindowsIdentity.GetCurrentInternal(TokenAccessLevels