-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Extend property assignment event (The feature is opted-out by default) #11106
base: main
Are you sure you want to change the base?
Extend property assignment event (The feature is opted-out by default) #11106
Conversation
…gic on bin log side
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.
I have couple comments to consider.
The main thing before signoff - this is currently not a default behavior (neither with /bl) - correct? Property tracking needs to be explicitly opted in - right?
Please add that info into the PR description (as otherwise the 8.5% perf hit might be bit concerning and might need a bit more deeper look)
src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/PropertyGroupIntrinsicTask.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jan Krivanek <[email protected]>
How do I enable the feature for testing? What setting value did you use for perf testing? |
@@ -1176,7 +1176,9 @@ private BuildEventArgs ReadPropertyReassignmentEventArgs() | |||
propertyName, | |||
previousValue, | |||
newValue, | |||
location, | |||
fields.File, |
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.
In the Reader we can't change the logic without also checking the version. Because if we're reading an old binlog, this is going to read corrupt data.
You can add if (version >= 25) ... read new stuff, otherwise leave the current logic
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.
You changed the reader to read the File, Line and Column separately, but the writer still writes Location as a single string
@@ -567,11 +567,12 @@ private BinaryLogRecordKind Write(CriticalBuildMessageEventArgs e) | |||
|
|||
private BinaryLogRecordKind Write(PropertyReassignmentEventArgs e) | |||
{ | |||
WriteMessageFields(e, writeMessage: false, writeImportance: true); | |||
WriteMessageFields(e, writeMessage: true, writeImportance: true); |
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.
why is this changing to true?
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.
previously, the message was provided by logviewer resources.
In this PR I attempted to pass a localized Message from MSBuild
There are two things I did to investigate the binlog size increase:
For diffing, pick a simple console application, and do an incremental build (not clean build), setting MsBuildLogPropertyTracking to the right value. What is the default value for it currently? Why are property reassignment messages even logged when the value is 0 (the current default)? |
Ah, I see: msbuild/src/Build/Evaluation/PropertyTrackingEvaluatorDataWrapper.cs Lines 320 to 323 in 4042363
|
I'm not quite sure, but I think we might have lost the location for property reassignment with #10102 (FYI @JanKrivanek) |
MSBuild 17.12 (the one I use) doesn't log PropertyReassignmentEventArgs, it logs a message, which the viewer than parses, and there is no location there |
Wait, no, I'm super confused. The location was only null for properties coming from toolset. For properties coming from XML the location is there and was passed as a string argument (one of 4 args). This is good, we have an opportunity to be better than the current state. |
location?.File, | ||
location?.Line ?? 0, | ||
location?.Column ?? 0, | ||
message: ResourceUtilities.GetResourceString("PropertyReassignment")) |
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.
why do we need this? I think we can leave the message null.
Even if we needed this, we could call GetResourceString once and cache it, since it never changes, and it's pretty expensive.
location?.File, | ||
location?.Line ?? 0, | ||
location?.Column ?? 0, | ||
ResourceUtilities.GetResourceString("PropertyAssignment")) |
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.
I'd avoid getting this string at all.
{ | ||
get | ||
{ | ||
var formattedSource = File != null ? $"{File} ({LineNumber},{ColumnNumber})" : PropertySource; |
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.
we probably want to cache this in case Message gets called multiple times, need to see what other EventArgs classes do when they override Message
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.
We could get the string from resources here, since we know what string we want.
|
||
return RawMessage; | ||
string formattedLocation = File != null ? $"{File} ({LineNumber},{ColumnNumber})" : Location; | ||
return string.Format(RawMessage, PropertyName, NewValue, PreviousValue, formattedLocation); |
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.
Same, look into caching the formatted result and look into getting the resource string here.
Did we have the location for props comming from toolset before? Or is that regression? |
please set MsBuildLogPropertyTracking=15 |
Fixes #2711
and connected to KirillOsenkov/MSBuildStructuredLog#839
Context
The feature is opted-out by default due to perf considerations !
This implementation covers cases:
Global
source)Also, the message formatting logic was changed for
PropertyReassignmentEventArgs
andPropertyInitialValueSetEventArgs
to have it optimized for existing deduplication logic.The event save all the unique data and format it on the receiving side (e.g. LogViewer).
The measurements were taken for the latest OrchardCode
Conclusions: