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

[X] avoid AmbiguousMatchException #15873

Merged
merged 1 commit into from
Aug 15, 2023
Merged

[X] avoid AmbiguousMatchException #15873

merged 1 commit into from
Aug 15, 2023

Conversation

StephaneDelcroix
Copy link
Contributor

Description of Change

with XamlC disabled, setting an overriden property throws a AmbiguousMatchException. This fixes the mismatch between the 2 inflaters.

Issues Fixed

@jsuarezruiz jsuarezruiz added the area-xaml XAML, CSS, Triggers, Behaviors label Jun 27, 2023
@hartez hartez changed the title [X] avoid AmibuousMatchException [X] avoid AmbiguousMatchException Jul 5, 2023
throw new XamlParseException($"Multiple properties with name '{property.DeclaringType}.{property.PropertyName}' found.", lineInfo, innerException: e);
}
};
minforetriever = () => property.DeclaringType.GetRuntimeProperties().FirstOrDefault(pi => pi.Name == property.PropertyName);
Copy link
Member

Choose a reason for hiding this comment

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

In case anyone else is also curious, initially I was a bit unsure if using the GRP method would fix the issue of retrieving the correct property when there are multiple present. But after talking to @StephaneDelcroix offline and looking at some docs, GRP is built on top of GetProperties, and starting from .NET 7, the order in which the properties are returned is "deterministic based upon the metadata ordering in the assembly" (docs). So, using FirstOrDefault in conjunction with GRP works in our favor to get the relevant property we are seeking.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jfversluis
Copy link
Member

/rebase

with XamlC disabled, setting an overriden property throws a
AmbiguousMatchException. This fixes the mismatch between the 2
inflaters.

- fixes #13962
@jfversluis jfversluis enabled auto-merge (squash) August 15, 2023 18:45
@samhouts samhouts added this to the Under Consideration milestone Aug 15, 2023
@jfversluis jfversluis merged commit 7f60836 into main Aug 15, 2023
40 checks passed
@jfversluis jfversluis deleted the fix13962 branch August 15, 2023 22:33
rmarinho pushed a commit that referenced this pull request Aug 19, 2023
with XamlC disabled, setting an overriden property throws a
AmbiguousMatchException. This fixes the mismatch between the 2
inflaters.

- fixes #13962
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
@samhouts samhouts removed this from the Under Consideration milestone Jul 1, 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-xaml XAML, CSS, Triggers, Behaviors fixed-in-8.0.0-rc.1.9171 Look for this fix in 8.0.0-rc.1.9171
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AmbiguousMatchException when BindableProperty is hidden in a derived class and is then set in XAML
5 participants