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

EventSourceSink refactor #10768

Merged
merged 4 commits into from
Oct 9, 2024
Merged

EventSourceSink refactor #10768

merged 4 commits into from
Oct 9, 2024

Conversation

SimaTian
Copy link
Member

@SimaTian SimaTian commented Oct 8, 2024

Fixes #10245

Context

EventSourceSink.cs

Changes Made

removed RaiseSomeEvent handlers and replaced them by generic one.

Testing

Notes

@SimaTian SimaTian force-pushed the EventSourceSink-refactor-10245 branch from 084aa69 to 01473dd Compare October 8, 2024 09:49
@SimaTian
Copy link
Member Author

SimaTian commented Oct 8, 2024

@dotnet-policy-service agree [company="Microsoft"]

@SimaTian
Copy link
Member Author

SimaTian commented Oct 8, 2024

What is our approach to squashing? Do we squash everything to one commit before merge or is there some other sort of rule of thumb to follow please?

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.

Nice reduction of code repetition!

I'd love this change to at the same time remove the #nullable disable to get stricter nullabvility checking and guarantees - as with the reduced code it should be easy to tackle. Or at least enable (#nullable enable) it for the refactored code

…g separate logging. removing null arguments, removing #nullable disable
@JanKrivanek
Copy link
Member

What is our approach to squashing? Do we squash everything to one commit before merge or is there some other sort of rule of thumb to follow please?

We squash during merging (GH can do that for you).

@SimaTian
Copy link
Member Author

SimaTian commented Oct 8, 2024

@dotnet-policy-service agree company="Microsoft"

Copy link
Member

@surayya-MS surayya-MS left a comment

Choose a reason for hiding this comment

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

Looks neat!

@SimaTian SimaTian merged commit a0b8ec4 into main Oct 9, 2024
10 checks passed
@SimaTian SimaTian deleted the EventSourceSink-refactor-10245 branch October 9, 2024 08:05
@SimaTian SimaTian changed the title EventSourceSink refactor [testing needed, do not merge] EventSourceSink refactor Oct 9, 2024
Copy link

@donJoseLuis donJoseLuis left a comment

Choose a reason for hiding this comment

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

a couple of comments, only

@@ -27,92 +25,92 @@ internal sealed class EventSourceSink :
/// <summary>
/// This event is raised to log a message.
/// </summary>
public event BuildMessageEventHandler MessageRaised;
public event BuildMessageEventHandler? MessageRaised;

Choose a reason for hiding this comment

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

why use the old event versus reactive extensions?

Copy link
Member

Choose a reason for hiding this comment

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

IIRC this was discussed earlier on a different PR already.

  • Rx.NET needs additional libs (not used accross VS or sdk) - which would require perf justification
  • Introducing new paradigm to existing code base with diferent paradigm is net negative (there would be two paradigms or a very extensive refactoring of the whole codebase would be needed). In a new codebase it can be great
  • This would be breaking to a fundamental public API (IEventSource)

break;
case BuildCheckEventArgs buildCheckEvent:
RaiseBuildCheckEvent(null, buildCheckEvent);
RaiseEvent(buildCheckEvent, args => BuildCheckEventRaised?.Invoke(null, args), RaiseAnyEvent);
break;

default:

Choose a reason for hiding this comment

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

consider a default action, at least a log entry

Copy link
Member

Choose a reason for hiding this comment

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

It already has ErrorUtilities.ThrowInternalError("Unknown event args type.");

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.

Remove code repetition in EventSourceSink.cs
4 participants