[Config Registry] 6/6 Forbid use of System.Environment methods and adapt everywhere#7905
Closed
anna-git wants to merge 0 commit intoanna/config-inversion-configuration-analyzers-4from
Conversation
3cf027a to
9d07021
Compare
8ee1b57 to
534627b
Compare
9d07021 to
3fae9ea
Compare
534627b to
f6f071c
Compare
3fae9ea to
faad2d7
Compare
8e858f0 to
58cf443
Compare
faad2d7 to
91a3181
Compare
58cf443 to
ed14287
Compare
91a3181 to
95b0301
Compare
Base automatically changed from
anna/config-inversion-use-generate-config-keys-5
to
anna/config-inversion-configuration-analyzers-4
December 9, 2025 15:43
ed14287 to
346d13a
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Part of Configuration Inversion (Step 6) - Stack progress:
I'll update the PR summary to mention the YAML documentation file:
Summary of changes
Banned direct
System.Environment.GetEnvironmentVariable()usage and migrated all environment variable access to useEnvironmentHelperswith strongly-typed ConfigurationKeys andPlatformKeysconstants.Key changes:
System.Environment.GetEnvironmentVariable()viaBannedApiAnalyzersEnvironmentGetEnvironmentVariableAnalyzer(DD0009) to enforce ConfigurationKeys/PlatformKeysusage onlyPlatformKeysby category (Ci, Aws, AzureAppService, ServiceFabric, DotNet)Reason for change
Direct
System.Environment.GetEnvironmentVariable()calls with string literals are error-prone. Centralizing throughEnvironmentHelperswith strongly-typed constants provides compile-time validation, discoverability, and refactoring safety.Implementation details
BannedSymbols.txtand configured.editorconfigto treat RS0030 as error (vendored code excluded)EnvironmentHelperscalls accept only ConfigurationKeys/PlatformKeysconstants, rejecting hardcoded stringsTest coverage
System.EnvironmentusageOther details
+2,600/-940 lines. No breaking changes, negligible performance impact.