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

[core] factory methods for registering services, part 2 #17004

Merged
merged 1 commit into from
Aug 26, 2023

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Aug 25, 2023

b0bba51 was incomplete, in that it missed registrations with 1 type argument:

builder.Services.AddScoped<HideSoftInputOnTappedChangedManager>();

So we need to add entries with "`1" for all of the banned methods:

++M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead

We can improve startup time by using a factory method instead:

builder.Services.AddScoped(_ => new HideSoftInputOnTappedChangedManager());

This also found a couple more calls to fix throughout .NET MAUI.

b0bba51 was incomplete, in that it missed registrations with 1 type
argument:

    builder.Services.AddScoped<HideSoftInputOnTappedChangedManager>();

So we need to add entries with "`1" for all of the banned methods:

    ++M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
    M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead

We can improve startup time by using a factory method instead:

    builder.Services.AddScoped(_ => new HideSoftInputOnTappedChangedManager());

This also found a couple more calls to fix throughout .NET MAUI.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review August 25, 2023 17:34
@jonathanpeppers jonathanpeppers requested review from a team as code owners August 25, 2023 17:34
@Eilon Eilon added the area-core-hosting Extensions / Hosting / AppBuilder / Startup label Aug 25, 2023
@jonathanpeppers jonathanpeppers added the legacy-area-perf Startup / Runtime performance label Aug 25, 2023
@mattleibow mattleibow merged commit 79a44ff into dotnet:main Aug 26, 2023
rmarinho added a commit that referenced this pull request Aug 29, 2023
* [Android] Fix Keyboard.Numeric issue (#16163)

* Fix Keyboard.Numeric issue on DisplayPromptAsync on Android

* Remove AlertsPage sample

---------

Co-authored-by: Rachel Kang <[email protected]>

* Invalidate shell tab title on Windows (#16593)

Co-authored-by: Rui Marinho <[email protected]>

* Fix Flyout Crash (Windows) (#16800)

* Fix flyout crash due to invalid casting of child

* Add tests

* Add additional tests, PR feedback

* Fix missing call to `RemoveLogicalChild`

* Update Clear

---------

Co-authored-by: Mike Corsaro <[email protected]>

* [core] factory methods for registering services, part 2 (#17004)

b0bba51 was incomplete, in that it missed registrations with 1 type
argument:

    builder.Services.AddScoped<HideSoftInputOnTappedChangedManager>();

So we need to add entries with "`1" for all of the banned methods:

    ++M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
    M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead

We can improve startup time by using a factory method instead:

    builder.Services.AddScoped(_ => new HideSoftInputOnTappedChangedManager());

This also found a couple more calls to fix throughout .NET MAUI.

* [create-pull-request] automated change (#17017)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Ignore failures from newly added UITests temporarily (#17003)

* Ignore failures from WhenQueryingCarouselItemsInViewThenSingleItemIsRetrieved

* Update Ignore to include all platformss

* Center window on WinUI, so it's always fully on screen in CI

* Set agent screen resolution bigger for UI tests

* Update baseline snapshots for bigger screen

* Just set screen resolution on Windows

* Ignore Issue16320 on Android

* Fix Android text alignment in migrated projects (#16986)

* Fix Android text alignment in migrated projects

* Add (manual) device tests

* Add clarifying comment

* [tentative] Move input tests to generic code

* Wrap up tests

* Make masks constants

* Fix title to be consistent with other test names

* Fix the order of logical modifications (#17020)

* Fix the order of logical modifications

* - keep in sync while removing

* - fix clear

---------

Co-authored-by: Javier Suárez <[email protected]>
Co-authored-by: Rachel Kang <[email protected]>
Co-authored-by: Mike Corsaro <[email protected]>
Co-authored-by: Mike Corsaro <[email protected]>
Co-authored-by: Jonathan Peppers <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Bret Johnson <[email protected]>
Co-authored-by: Juan Diego Herrera <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
PureWeen added a commit that referenced this pull request Aug 29, 2023
PureWeen added a commit that referenced this pull request Aug 29, 2023
… 2 (#17004)""

This reverts commit ed9a1fc.

# Conflicts:
#	eng/BannedSymbols.txt
#	src/BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs
PureWeen added a commit that referenced this pull request Aug 30, 2023
* Revert "[core] factory methods for registering services, part 2 (#17004)"

This reverts commit 79a44ff.

* Revert "[android] fix DI registration for Frame, ListView, TableView (#16989)"

This reverts commit 136f21d.

* Revert "[core] use factory methods for registering services (#16741)"

This reverts commit b0bba51.

# Conflicts:
#	src/Controls/src/Xaml/Hosting/AppHostBuilderExtensions.cs
#	src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt

* Revert "Revert "[core] factory methods for registering services, part 2 (#17004)""

This reverts commit ed9a1fc.

# Conflicts:
#	eng/BannedSymbols.txt
#	src/BlazorWebView/src/SharedSource/BlazorWebViewServiceCollectionExtensions.cs

* Restore some changes (so hopefully it builds now?)

Diff is also smaller

---------

Co-authored-by: Jonathan Peppers <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2023
@Eilon Eilon added t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) and removed legacy-area-perf Startup / Runtime performance labels May 10, 2024
@samhouts samhouts added the fixed-in-8.0.0-rc.1.9171 Look for this fix in 8.0.0-rc.1.9171 label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-core-hosting Extensions / Hosting / AppBuilder / Startup fixed-in-8.0.0-rc.1.9171 Look for this fix in 8.0.0-rc.1.9171 t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants