-
Notifications
You must be signed in to change notification settings - Fork 323
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
Enable nullable for EventLogCollector #3674
Enable nullable for EventLogCollector #3674
Conversation
DataCollectionEvents events!!, | ||
DataCollectionSink dataSink!!, | ||
DataCollectionLogger logger!!, | ||
DataCollectionEnvironmentContext dataCollectionEnvironmentContext) | ||
DataCollectionEnvironmentContext dataCollectionEnvironmentContext!!) |
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.
This is a change of behavior but we weren't doing null check so if Initialize
is called with null for this arg we would fail with NRE.
public override void Initialize( | ||
XmlElement configurationElement, | ||
XmlElement? configurationElement, |
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.
Functionally we should accept only non-null but that would be a change of behavior so I decided to allow null.
@@ -267,6 +266,7 @@ internal string WriteEventLogs(List<EventLogEntry> eventLogEntries, int maxLogEn | |||
// Write the event log file | |||
FileTransferInformation fileTransferInformation = | |||
new(dataCollectionContext, eventLogPath, true, _fileHelper); | |||
TPDebug.Assert(_dataSink != null, "Initialize should have been called."); |
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 cannot use the initialize pattern we were talking about because this method is called from within the Initialize
method.
Contributes to AB#1549371