-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] Compile StaticResource when possible #20917
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comment on lines
+140
to
+153
var staticResourceExtensionType = module.ImportReference(context.Cache, | ||
("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml", "StaticResourceExtension")); | ||
yield return Create(Newobj, module.ImportCtorReference(context.Cache, | ||
staticResourceExtensionType, | ||
paramCount: 0)); | ||
|
||
SetPropertiesVisitor.TryGetPropertyName(node, node.Parent, out var propertyName); | ||
var localName = propertyName.LocalName; | ||
|
||
//Set the Key | ||
var keyProperty = staticResourceExtensionType.GetProperty(context.Cache, pd => pd.Name == "Key", out _); | ||
yield return Create(Dup); | ||
yield return Create(Ldstr, key); | ||
yield return Create(Callvirt, module.ImportReference(keyProperty.SetMethod)); |
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 creating a duplicate StaticResourceExtension
instance, this is what I see in decompiled code:
staticResourceExtension.Key = "Primary";
StaticResourceExtension obj = new StaticResourceExtension
{
Key = "Primary"
};
Could we reuse the original StaticResourceExtension
instance instead of creating a new one?
src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticResourceExtension.cs
Show resolved
Hide resolved
when a resource can be compiled locally, do it. TODO: convert OnPlatform TODO: walk up DataTemplates - fixes #20244
StephaneDelcroix
force-pushed
the
fix_20244
branch
from
September 11, 2024 09:20
819bc7c
to
2209fd3
Compare
simonrozsival
approved these changes
Sep 27, 2024
rmarinho
pushed a commit
that referenced
this pull request
Sep 30, 2024
when a resource can be compiled locally, do it. TODO: convert OnPlatform TODO: walk up DataTemplates - fixes #20244
samhouts
added
fixed-in-net9.0-nightly
This may be available in a nightly release!
fixed-in-net8.0-nightly
This may be available in a nightly release!
labels
Oct 1, 2024
samhouts
added
fixed-in-9.0.0-rc.2.24503.2
fixed-in-net8.0-nightly
This may be available in a nightly release!
fixed-in-net9.0-nightly
This may be available in a nightly release!
and removed
fixed-in-net9.0-nightly
This may be available in a nightly release!
fixed-in-net8.0-nightly
This may be available in a nightly release!
labels
Oct 14, 2024
samhouts
added
fixed-in-9.0.12
and removed
fixed-in-net9.0-nightly
This may be available in a nightly release!
fixed-in-net8.0-nightly
This may be available in a nightly release!
labels
Dec 16, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-xaml
XAML, CSS, Triggers, Behaviors
fixed-in-9.0.0-rc.2.24503.2
fixed-in-9.0.12
stale
Indicates a stale issue/pr and will be closed soon
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
when a resource can be compiled locally, do it.
Issues Fixed