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

Move WeakEventManager to Core.csproj #5139

Merged
merged 10 commits into from
Mar 21, 2022

Conversation

TheCodeTraveler
Copy link
Contributor

Description of Change

This PR moves WeakEventManager to the Core.csproj project and updates its namespace:

  • Moving WeakEventManager.cs
    • src/Controls/src/Core/WeakEventManager.cs -> src/Core/src/WeakEventManager.cs
  • Updating WeakEventManager Namespace
    • namespace Microsoft.Maui.Controls -> namespace Microsoft.Maui

Additionally, this PR moves the associated Unit Tests to Core.UnitTests.csproj and updates its namespace:

  • Moving WeakEventManagerTests.cs
    • src/Controls/tests/Core.UnitTests/WeakEventManagerTests.cssrc/Core/tests/UnitTests/WeakEventManagerTests.cs
  • Updating WeakEventManagerTests Namespace
    • Microsoft.Maui.Controls.Core.UnitTests -> Microsoft.Maui.UnitTests

Additional Information

On the .NET MAUI Community Toolkit team, we strive to keep the .NET MAUI Community Toolkit architecture aligned with the .NET MAUI architecture. To accomplish this, we have a CommunityToolkit.Maui.Core project that maps to the .NET MAUI code in Core.csproj (aka /src/Core/).

Mimicking .NET MAUI's architecture ensures a frictionless process to promote features from the .NET MAUI Community Toolkit into .NET MAUI once the features have matured and been approved.

We'd really love to use WeakEventManager with our Core project, but right now we can't because it's in the *.Controls namespace.

Moving WeakEventManager to Core.csproj also allows other Frameworks built using .NET MAUI (e.g. Comet, BlazorWebView) to also leverage WeakEventManager.

.NET MAUI Community Toolkit Contributions Guide

/~https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#where-to-make-your-changes

MicrosoftTeams-image

@TheCodeTraveler
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 5139 in repo dotnet/maui

@Redth Redth requested review from Clancey and mattleibow March 8, 2022 22:09
@Clancey
Copy link
Contributor

Clancey commented Mar 8, 2022

I am fine with this being in Core. It might come in handy with our handlers and native events. As long as this doesn't encourage/have us adding events on our interfaces.

@rmarinho
Copy link
Member

rmarinho commented Mar 9, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@TheCodeTraveler
Copy link
Contributor Author

TheCodeTraveler commented Mar 9, 2022

I've updated this PR to fix the CI errors caused by not previously updating the XML docs references.

I think I did it correctly, but would be good to double-check my work with WeakEventManager.xml 👍

@Eilon Eilon added the area-architecture Issues with code structure, SDK structure, implementation details label Mar 9, 2022
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Approving this as we probs need it in core and should use it for platform subscriptions.

But, is approval only applies if this feature does not exist in the BCL. It has been years since forms was created, have we added something like this to the BCL yet? Either an API or a language feature?

@TheCodeTraveler
Copy link
Contributor Author

Thanks @mattleibow!

WeakEventManager is not yet in the .NET BCL, but there is an open Issue requesting it to be added based on our implementation: dotnet/runtime#61517 (comment)

@TheCodeTraveler
Copy link
Contributor Author

TheCodeTraveler commented Mar 9, 2022

/azp run

Edit: Dang - I was really hoping it would work after trying it again a 2nd time 😅

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 5139 in repo dotnet/maui

@azure-pipelines
Copy link

Command 'run

Edit:' is not supported by Azure Pipelines.



Supported commands

  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@Redth
Copy link
Member

Redth commented Mar 9, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@mattleibow
Copy link
Member

/azp run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@mattleibow mattleibow enabled auto-merge (squash) March 15, 2022 00:17
auto-merge was automatically disabled March 15, 2022 00:45

Head branch was pushed to by a user without write access

@TheCodeTraveler
Copy link
Contributor Author

Can I get another /azp run to see if the docs build script is fixed?

@mattleibow
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Redth Redth enabled auto-merge (squash) March 21, 2022 15:31
@Redth Redth added this to the 6.0.300-rc.1 milestone Mar 21, 2022
@Redth Redth merged commit aa2d111 into dotnet:main Mar 21, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
@samhouts samhouts added the fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-architecture Issues with code structure, SDK structure, implementation details fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1!
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants