diff --git a/src/VirtualClient/VirtualClient.Common/ProcessProxy.cs b/src/VirtualClient/VirtualClient.Common/ProcessProxy.cs
index d01609c80f..3720948426 100644
--- a/src/VirtualClient/VirtualClient.Common/ProcessProxy.cs
+++ b/src/VirtualClient/VirtualClient.Common/ProcessProxy.cs
@@ -316,11 +316,12 @@ public virtual bool Start()
/// The processor affinity bitmask.
public virtual void SetProcessorAffinity(IntPtr affinityMask)
{
-#if WINDOWS
+ if (!OperatingSystem.IsWindows())
+ {
+ throw new PlatformNotSupportedException("Setting processor affinity is only supported on Windows platform.");
+ }
+
this.UnderlyingProcess.ProcessorAffinity = affinityMask;
-#else
- throw new PlatformNotSupportedException("Setting processor affinity is only supported on Windows platform.");
-#endif
}
///