This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 53203 - XAMLC: AttachedProperty not found
Summary: XAMLC: AttachedProperty not found
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
URL:
Depends on:
Blocks:
 
Reported: 2017-03-09 18:18 UTC by adamhewitt
Modified: 2017-03-22 17:01 UTC (History)
4 users (show)

See Also:
Tags: xamlc, attached property, AC
Is this bug a regression?: Yes
Last known good build: 2.3.3.193


Attachments
Reproduction project (2.11 KB, application/x-zip-compressed)
2017-03-09 18:18 UTC, adamhewitt
Details

Description adamhewitt 2017-03-09 18:18:44 UTC
Created attachment 20254 [details]
Reproduction project

This is related to https://bugzilla.xamarin.com/show_bug.cgi?id=51773 but shows up differently. The attached reproduction shows it better than I can describe, but the long story short is a Xamlc error when using {x:Static} (And maybe other markup extensions?) to set an attached property.

e.g.
<StackLayout local:AttachedProperties.Parameter="{x:Static local:Values.Better}" />
Comment 1 adamhewitt 2017-03-09 18:22:50 UTC
I meant to also say this doesn't occur on 2.3.3.180.
Comment 2 adamhewitt 2017-03-09 18:28:47 UTC
Actually, I do get the exact error on 2.3.3.180, except with a custom markup extension instead of {x:Static}. It's the error that prompted me to try 2.3.4.192, which raised the other XAMLC errors I've now reported.
Comment 3 Jimmy 2017-03-10 16:18:58 UTC
Thank you for this report! Let me try the code you provided to see if I can confirm this issue and I will update the report accordingly.
Comment 4 Jimmy 2017-03-10 17:47:21 UTC
I believe I am able to reproduce this issue with Forms 2.3.4-pre4. When building the project with XamlC enabled, I get

> Position 8:12. No property, bindable property, or event found for 'Parameter'

The same project builds successfully with Forms 2.3.3.193 so this does appear to be a regression. I am confirming this report so the team can investigate further.


### Regression Test
Forms 2.3.4-pre4    BAD
Forms 2.3.3.193     GOOD
Forms 2.3.3.180     GOOD
Comment 5 Stephane Delcroix 2017-03-22 12:38:49 UTC
I'm looking at solving this. You can workaround this by having your parameter of the same type as your value. I think the compiler is tripping on the boxing here.
Comment 6 adamhewitt 2017-03-22 13:44:08 UTC
Good to know, but my actual usage requires object, as it's attaching a CommandParameter to list Cells. A fix would certainly be preferred, but another workaround I would expect to work would be an IMarkupExtension<object>. Something like:

Parameter="{ext:ValueExtension Value={x:Static local:Values.Better}}"
Comment 7 adamhewitt 2017-03-22 13:48:40 UTC
I've been wanting to ask - are there any plans to have XAMLC just generate C# like the UWP build? Seems to me that gets to the heart of a lot of these errors and would allow users to debug the failures.
Comment 8 Rui Marinho 2017-03-22 17:01:17 UTC
Should be fixed on 2.3.4-pre6

Note You need to log in before you can comment on or make changes to this bug.