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

Log ETW for SDK resolution again #9393

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

rainersigwald
Copy link
Member

@rainersigwald rainersigwald commented Nov 3, 2023

EventSource.WriteEvent() can, instead of writing the specified event, instead create Microsoft-Build/EventSourceMessage events that look like

EventSourceException while processing event "SdkResolverResolveSdkStop": Null passed as a event argument.
EventSourceException while processing event "CachedSdkResolverServiceResolveSdkStop": Null passed as a event argument.

Fix instances of this by enabling nullable analysis in MSBuildEventSource.cs and then fixing the errors that arose.

Fixes #8519.

While investigating this I noticed one event that had had a field added but no version bump, so I fixed that too.

With this change I see events:
image

Per https://learn.microsoft.com/dotnet/api/system.diagnostics.tracing.eventsource#conventions,
the version field for events must increment any time the payload is
added to.

I looked at https://github.com/dotnet/msbuild/blame/31c4d335325e858a3c4dba66d921d0e31bdee5ff/src/Framework/MSBuildEventSource.cs
and added a version bump to every event that wasn't from 45e27c1,
ad3e7d0, or an introduction of the event, and found only this one.
`EventSource.WriteEvent()` can, instead of writing the specified event, instead
create `Microsoft-Build/EventSourceMessage` events that look like

```
EventSourceException while processing event "SdkResolverResolveSdkStop": Null passed as a event argument.
EventSourceException while processing event "CachedSdkResolverServiceResolveSdkStop": Null passed as a event argument.
```

Fix all instances of this by enabling nullable analysis in
`MSBuildEventSource.cs` and then fixing the errors that arose.

Fixes dotnet#8519.
@rainersigwald rainersigwald marked this pull request as draft November 3, 2023 15:57
@rainersigwald
Copy link
Member Author

v1 of this fix is incomplete, because it didn't actually fix SdkResolverResolveSdkStop/CachedSdkResolverServiceResolveSdkStop. They only work in solution context today. Trying to figure out if there's a good way to ensure a fix for the whole category of bug.

@rainersigwald
Copy link
Member Author

Trying to figure out if there's a good way to ensure a fix for the whole category of bug.

Tried #9395 but I think our normal build with the text perf log doesn't fire enough of the events to catch the SDK ones that are known (now) to be broken.

@rainersigwald rainersigwald marked this pull request as ready for review November 3, 2023 22:03
Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@rainersigwald rainersigwald merged commit d8283be into dotnet:main Nov 30, 2023
8 checks passed
@rainersigwald rainersigwald deleted the fix-sdk-resolver-events branch November 30, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing SdkResolverResolveSdk/Stop event
5 participants