-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add trace log message when failing to find Env Var #13777
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13777 +/- ##
===========================================
- Coverage 94.28% 7.71% -86.57%
===========================================
Files 1113 7 -1106
Lines 100791 350 -100441
Branches 8734 127 -8607
===========================================
- Hits 95028 27 -95001
+ Misses 4595 322 -4273
+ Partials 1168 1 -1167
Flags with carried forward coverage won't be shown. Click here to find out more. |
@StephenWeatherford I see that one test is failing, but I don't really understand why, don't think it is related to the changes made. Can you help me run it again? |
arguments[0].Span, | ||
DiagnosticLevel.Info, | ||
"Bicepparam ReadEnvironmentVariable function", | ||
"Available environment variables are: " + string.Join(", ", model.Environment.GetVariableNames()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this check do something similar to how we handle unknown properties in the type checker? There's a utility method to detect likely typos and include a "did you mean 'x'?" message on
bicep/src/Bicep.Core/TypeSystem/TypeHelper.cs
Line 224 in 126cd59
true => SpellChecker.GetSpellingSuggestion(propertyName, availableProperties) switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great idea!
I'll look into that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test this change out locally with the following install scripts (Action run 9489043222) VSCode
Azure CLI
|
Fixes #13100
If verbose is set to true in bicepconfig.json, bicep now logs the names of all available environment variables when function readEnvironmentVariable fails to find the variable specified. This should hopefully help troubleshoot errors related to this function.
Example of output before:
Example of output after:
Contributing a feature
Microsoft Reviewers: Open in CodeFlow