// ReSharper disable once VirtualMemberCallInConstructor
 public FactWindowsOnlyAttribute(string nonWindowsSkipReason)
 {
     if (!RuntimeInformation.IsWindows())
     {
         Skip = nonWindowsSkipReason;
     }
 }
Example #2
0
            // see https://msdn.microsoft.com/en-us/library/windows/desktop/ms684139%28v=vs.85%29.aspx
            public static bool Is64Bit(Process process)
            {
                if (Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") == "x86")
                {
                    return(false);
                }

                if (RuntimeInformation.IsWindows())
                {
                    IsWow64Process(process.Handle, out bool isWow64);

                    return(!isWow64);
                }

                return(RuntimeInformation.Is64BitPlatform()); // todo: find the way to cover all scenarios for .NET Core
            }
Example #3
0
        private static bool Initialize(out long qpf)
        {
            if (!RuntimeInformation.IsWindows())
            {
                qpf = default;
                return(false);
            }

            try
            {
                return(QueryPerformanceFrequency(out qpf) && QueryPerformanceCounter(out _));
            }
            catch
            {
                qpf = default;
                return(false);
            }
        }