{"record":{"id":"56fbcad2152d4b7c","repo":"dotnet/BenchmarkDotNet","slug":"largeaddressaware-is-a-windows-specific-concept","errorCode":null,"errorMessage":"LargeAddressAware is a Windows-specific concept.","messagePattern":"LargeAddressAware is a Windows-specific concept\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Jobs/EnvironmentMode.cs","lineNumber":118,"sourceCode":"        public Guid? PowerPlanMode\n        {\n            get => PowerPlanModeCharacteristic[this];\n            set => PowerPlanModeCharacteristic[this] = value;\n        }\n\n        /// <summary>\n        /// Specifies that benchmark can handle addresses larger than 2 gigabytes.\n        /// <value>false: Benchmark uses the default (64-bit: enabled; 32-bit:disabled). This is the default.</value>\n        /// <value>true: Explicitly specify that benchmark can handle addresses larger than 2 gigabytes.</value>\n        /// </summary>\n        public bool LargeAddressAware\n        {\n            get => LargeAddressAwareCharacteristic[this];\n            set\n            {\n                if (value && !OsDetector.IsWindows())\n                {\n                    throw new NotSupportedException(\"LargeAddressAware is a Windows-specific concept.\");\n                }\n\n                LargeAddressAwareCharacteristic[this] = value;\n            }\n        }\n\n        /// <summary>\n        /// Adds the specified <paramref name=\"variable\"/> to <see cref=\"EnvironmentVariables\"/>.\n        /// If <see cref=\"EnvironmentVariables\"/> already contains a variable with the same key,\n        /// it will be overriden.\n        /// </summary>\n        /// <param name=\"variable\">The new environment variable which should be added to <see cref=\"EnvironmentVariables\"/></param>\n        public void SetEnvironmentVariable(EnvironmentVariable variable)\n        {\n            var newVariables = new List<EnvironmentVariable>();\n            newVariables.AddRange(EnvironmentVariables);\n            newVariables.RemoveAll(v => v.Key.Equals(variable.Key, StringComparison.Ordinal));\n            newVariables.Add(variable);","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Jobs/EnvironmentMode.cs#L100-L136","documentation":"Thrown when a user sets LargeAddressAware = true on a non-Windows operating system. LargeAddressAware is a Windows PE header flag that lets 32-bit processes access 4 GB of virtual address space instead of 2 GB. The setter explicitly checks OsDetector.IsWindows() and throws NotSupportedException to prevent setting a meaningless flag on Linux/macOS where the concept does not exist.","triggerScenarios":"Calling job.Configure(EnvironmentMode).LargeAddressAware = true or using the fluent API .WithLargeAddressAware(true) while running BenchmarkDotNet on Linux or macOS. The condition `value && !OsDetector.IsWindows()` evaluates true.","commonSituations":"Developers writing benchmarks on Windows that set LargeAddressAware for 32-bit memory-intensive benchmarks, then running the same benchmark suite in a Linux CI pipeline or Docker container. Also occurs when configuration is shared cross-platform via a common config class.","solutions":["Guard the call with an OS check: if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) job.WithLargeAddressAware(true)","Only set LargeAddressAware in a platform-specific configuration block rather than a shared config.","Remove the LargeAddressAware setting if targeting only 64-bit processes (64-bit already has full large address support by default)."],"exampleFix":"// before\nvar job = Job.Default.WithLargeAddressAware(true);\n\n// after\nvar job = Job.Default;\nif (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\n    job = job.WithLargeAddressAware(true);","handlingStrategy":"validation","validationCode":"if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\n{\n    job = job.WithLargeAddressAware(true);\n}","typeGuard":"static bool CanSetLargeAddressAware() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);","tryCatchPattern":null,"preventionTips":["Isolate platform-specific Job configuration in separate methods guarded by OS checks.","Run benchmark suites in CI on the same OS as production to catch platform mismatches early.","For 64-bit-only targets, LargeAddressAware is unnecessary — simply omit it."],"tags":["platform-specific","windows-only","environment-mode","not-supported"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}