Skip to content

Refresh of the observer pattern content#54113

Merged
adegeo merged 19 commits into
mainfrom
adegeo/52697/events
Jun 2, 2026
Merged

Refresh of the observer pattern content#54113
adegeo merged 19 commits into
mainfrom
adegeo/52697/events

Conversation

@adegeo
Copy link
Copy Markdown
Contributor

@adegeo adegeo commented Jun 1, 2026

Summary

I had most of this done last week and I just needed some fit-and-finish work today, but then I noticed that AI had really gone of the rails with the code migration. It migrated the code but had also rewritten it, desynching it with the article. The rewrite was good, but it hadn't accounted for the fact that the code project was used by two different articles. In the effort to simplify and rewrite, it had ruined the other article's content.

I had to rewind, and fix all of that.

It's now in a good place.

Fixes #52697


Internal previews

📄 File 🔗 Preview link
docs/standard/events/how-to-implement-a-provider.md How to implement a provider
docs/standard/events/how-to-implement-an-observer.md "How to implement an Observer"
docs/standard/events/observer-design-pattern-best-practices.md Best practices for the observer design pattern
docs/standard/events/observer-design-pattern.md docs/standard/events/observer-design-pattern

Copilot AI review requested due to automatic review settings June 1, 2026 23:44
@dotnetrepoman dotnetrepoman Bot added this to the June 2026 milestone Jun 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refreshes the Observer design pattern documentation by modernizing the articles and migrating the associated code samples into the docs-local snippets/ structure (including updated .NET target frameworks), while removing legacy snippet projects under samples/snippets/... that are no longer referenced.

Changes:

  • Update Observer pattern articles (including best practices and provider/observer how-tos) with refreshed guidance and updated snippet references.
  • Migrate the temperature monitor and baggage claim samples to docs/standard/events/snippets/..., adding new C# and Visual Basic snippet projects targeting net10.0.
  • Restructure the observables samples into language-specific folders and remove legacy shared C# files and older samples/snippets/... sources.

Reviewed changes

Copilot reviewed 42 out of 43 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesignpattern/vb/provider.vb Remove legacy VB baggage provider implementation (no longer referenced).
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesignpattern/vb/observer.vb Remove legacy VB arrivals monitor implementation (no longer referenced).
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesignpattern/vb/module1.vb Remove legacy VB program entry point (no longer referenced).
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesignpattern/vb/baggageinfo.vbproj Remove legacy VB project file for baggage sample.
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesign.howto/vb/temperaturemonitorvb.vbproj Remove legacy VB temperature monitor project file.
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesign.howto/vb/provider.vb Remove legacy VB provider implementation for temperature sample.
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesign.howto/vb/observer.vb Remove legacy VB observer implementation for temperature sample.
samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.observerdesign.howto/vb/data.vb Remove legacy VB temperature data type snippet.
samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/temperaturemonitorcs.csproj Remove legacy C# temperature monitor project file.
samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/provider.cs Remove legacy C# provider implementation for temperature sample.
samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/program.cs Remove legacy C# program entry point for temperature sample.
samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/observer.cs Remove legacy C# observer implementation for temperature sample.
samples/snippets/csharp/VS_Snippets_CLR/conceptual.observerdesign.howto/cs/data.cs Remove legacy C# temperature data type snippet.
docs/standard/events/snippets/shared/how-to-provider-observer/vb/temperaturemonitorvb.vbproj Add new docs-local VB snippet project targeting net10.0 for the provider/observer how-tos.
docs/standard/events/snippets/shared/how-to-provider-observer/vb/provider.vb Add refreshed VB provider sample (temperature monitor) with snippet markers.
docs/standard/events/snippets/shared/how-to-provider-observer/vb/program.vb Update VB program to run the async temperature sample.
docs/standard/events/snippets/shared/how-to-provider-observer/vb/observer.vb Add refreshed VB observer sample (temperature reporter) with snippet markers.
docs/standard/events/snippets/shared/how-to-provider-observer/vb/data.vb Add refreshed VB temperature data type with snippet markers.
docs/standard/events/snippets/shared/how-to-provider-observer/csharp/temperaturemonitorcs.csproj Add new docs-local C# snippet project targeting net10.0 for the provider/observer how-tos.
docs/standard/events/snippets/shared/how-to-provider-observer/csharp/provider.cs Add refreshed C# provider sample (temperature monitor) with snippet markers.
docs/standard/events/snippets/shared/how-to-provider-observer/csharp/program.cs Add refreshed C# program that runs the async temperature sample.
docs/standard/events/snippets/shared/how-to-provider-observer/csharp/observer.cs Add refreshed C# observer sample (temperature reporter) with snippet markers.
docs/standard/events/snippets/shared/how-to-provider-observer/csharp/data.cs Add refreshed C# temperature data type with snippet markers.
docs/standard/events/snippets/observables/vb/Observables.vbproj Add VB snippet project for the observables (baggage) sample targeting net10.0.
docs/standard/events/snippets/observables/vb/Program.vb Add VB program entry point for the baggage sample.
docs/standard/events/snippets/observables/vb/BaggageInfo.vb Add VB baggage info type (with equality support).
docs/standard/events/snippets/observables/vb/BaggageHandler.vb Add VB provider implementation for baggage notifications.
docs/standard/events/snippets/observables/vb/ArrivalsMonitor.vb Add VB observer implementation for displaying arrivals.
docs/standard/events/snippets/observables/vb/Unsubscriber.vb Add VB unsubscriber implementation for observables sample.
docs/standard/events/snippets/observables/Unsubscriber.cs Remove legacy shared C# unsubscriber (replaced by language-specific versions).
docs/standard/events/snippets/observables/Program.cs Remove legacy shared C# program (replaced by language-specific versions).
docs/standard/events/snippets/observables/BaggageHandler.cs Remove legacy shared C# baggage handler (replaced by language-specific versions).
docs/standard/events/snippets/observables/ArrivalsMonitor.cs Remove legacy shared C# arrivals monitor (replaced by language-specific versions).
docs/standard/events/snippets/observables/csharp/Observables.csproj Update C# observables snippet project to target net10.0.
docs/standard/events/snippets/observables/csharp/Program.cs Add C# program entry point for the baggage sample.
docs/standard/events/snippets/observables/csharp/BaggageInfo.cs Add C# baggage info record struct.
docs/standard/events/snippets/observables/csharp/BaggageHandler.cs Add C# provider implementation for baggage notifications.
docs/standard/events/snippets/observables/csharp/ArrivalsMonitor.cs Add C# observer implementation for displaying arrivals.
docs/standard/events/snippets/observables/csharp/Unsubscriber.cs Add C# unsubscriber implementation for observables sample.
docs/standard/events/observer-design-pattern.md Refresh article content and switch snippet references to the new docs-local snippet paths.
docs/standard/events/observer-design-pattern-best-practices.md Refresh best practices guidance and update metadata.
docs/standard/events/how-to-implement-an-observer.md Refresh observer how-to steps and switch to the shared docs-local snippets.
docs/standard/events/how-to-implement-a-provider.md Refresh provider how-to steps and switch to the shared docs-local snippets.

Comment thread docs/standard/events/how-to-implement-a-provider.md Outdated
Comment thread docs/standard/events/how-to-implement-a-provider.md Outdated
Comment thread docs/standard/events/snippets/observables/csharp/BaggageHandler.cs
Comment thread docs/standard/events/snippets/observables/vb/BaggageHandler.vb
Comment thread docs/standard/events/how-to-implement-a-provider.md Outdated
Copilot finished work on behalf of adegeo June 2, 2026 00:43
@adegeo adegeo marked this pull request as ready for review June 2, 2026 00:59
@adegeo adegeo requested review from a team and BillWagner as code owners June 2, 2026 00:59
Copy link
Copy Markdown
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

This LGTM overall. I had a few small suggestions to consider.

Comment thread docs/standard/events/snippets/observables/csharp/ArrivalsMonitor.cs Outdated
Comment thread docs/standard/events/snippets/observables/vb/ArrivalsMonitor.vb
Comment thread docs/standard/events/snippets/observables/vb/BaggageHandler.vb
Comment thread docs/standard/events/snippets/observables/vb/Unsubscriber.vb
Comment thread docs/standard/events/snippets/observables/vb/Unsubscriber.vb
…or.cs

Co-authored-by: Bill Wagner <wiwagn@microsoft.com>
@adegeo
Copy link
Copy Markdown
Contributor Author

adegeo commented Jun 2, 2026

As discussed, SyncLock doesn't actually support the Lock type.

@adegeo adegeo enabled auto-merge (squash) June 2, 2026 15:35
@adegeo adegeo merged commit 244e976 into main Jun 2, 2026
11 checks passed
@adegeo adegeo deleted the adegeo/52697/events branch June 2, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refresh Events Observer Design pattern content

4 participants