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
[XC] only generate the services that'll be used #19945
Conversation
@@ -10,6 +10,7 @@ | |||
namespace Microsoft.Maui.Controls | |||
{ | |||
/// <include file="../../docs/Microsoft.Maui.Controls/ReferenceTypeConverter.xml" path="Type[@FullName='Microsoft.Maui.Controls.ReferenceTypeConverter']/Docs/*" /> | |||
[RequireService([typeof(IReferenceProvider), typeof(IProvideParentValues)])] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only IExtendedTypeConverter that needs to be attributed, all the others have a compiled counterpart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is an example of the IL before & after? I have two apps and inspecting assemblies in ILSpy, but I'm not sure if I see the different yet.
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] | ||
public sealed class RequireServiceAttribute : Attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add a new API, should this go to .NET 9?
calls for x:Reference and x:StaticResource should produce different IL and no longer push an array with all parents |
Somehow it seems a bit slower? I do see IL changes though: Before: After: The most expensive method now is: Before, I don't think that was showing up as much.
|
The part that is concerning is somehow all |
Here is a |
/rebase |
32b2065
to
519dec2
Compare
4e3b3c7
to
3ba2adc
Compare
The base branch was changed.
/rebase |
3ba2adc
to
5591413
Compare
@@ -243,6 +243,11 @@ | |||
<data name="XDataTypeSyntax" xml:space="preserve"> | |||
<value>x:DataType expects a string literal, an {{x:Type}} markup or {{x:Nul}l}.</value> | |||
</data> | |||
<data name="UnattributedMarkupType" xml:space="preserve"> | |||
<value>Consider attributing the markup extension "{0}" with [RequireService] or [AcceptEmptyServiceProvider] if it doesn't require any.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created ticket because I think our localization is broken and these aren't getting translated, just a note I wanted to had so we can keep track of it.
MarkupExtensions, ValueProviders and some TypeConverters require a serviceProvider. Only add the services that are actually required. This will reduce IL size, time to JIT, number of allocations, ... Also add a warning when users do not attribute their MarkupExctensions - fixes #19650
5591413
to
436514b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing tests not related
Description of Change
MarkupExtensions, ValueProviders and some TypeConverters require a serviceProvider. Only add the services that are actually required. This will reduce IL size, time to JIT, number of allocations, ...
Also add a warning when users do not attribute their MarkupExctensions
Issues Fixed