Skip to content
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

Use MSBuild Logging APIs for Task output instead of StdOut #933

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix potential nonexistent dictionary access
  • Loading branch information
baronfel committed Mar 1, 2025
commit 5815ef3c212450b5200d7ef8eb0c818292af62f8
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Targets/MSBuildLogger.cs
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ public MSBuildLogger(TaskLoggingHelper loggingHelperToWrap)
public void Write(LogEvent logEvent)
{
var logLevel = logEvent.Level;
if (logLevel is LogEventLevel.Warning && logEvent.Properties["SourceContext"] is ScalarValue sv && sv.Value is string svv && svv.StartsWith("Microsoft.ComponentDetection", StringComparison.Ordinal))
if (logLevel is LogEventLevel.Warning && logEvent.Properties.TryGetValue("SourceContext", out var lepv) && lepv is ScalarValue sv && sv.Value is string svv && svv.StartsWith("Microsoft.ComponentDetection", StringComparison.Ordinal))
{
// Component Detection fires a lot of warnings, translate these to Information
logLevel = LogEventLevel.Information;
Loading
Oops, something went wrong.