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

Enable nullable for EventLogCollector #3674

Merged
merged 3 commits into from
May 27, 2022

Conversation

Evangelink
Copy link
Member

@Evangelink Evangelink commented May 24, 2022

Contributes to AB#1549371

DataCollectionEvents events!!,
DataCollectionSink dataSink!!,
DataCollectionLogger logger!!,
DataCollectionEnvironmentContext dataCollectionEnvironmentContext)
DataCollectionEnvironmentContext dataCollectionEnvironmentContext!!)
Copy link
Member Author

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,
Copy link
Member Author

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.");
Copy link
Member Author

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.

@Evangelink Evangelink enabled auto-merge (squash) May 26, 2022 13:16
@Evangelink Evangelink merged commit 7ae8667 into microsoft:main May 27, 2022
@Evangelink Evangelink deleted the EventLogCollector-nullable branch May 30, 2022 06:54
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.

2 participants