Bug 60373 - CustomizeAnimation sample (and possibly Animator property?) broken (since XM 2.8)
Summary: CustomizeAnimation sample (and possibly Animator property?) broken (since XM ...
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 4.0 (d15-5)
Hardware: PC Mac OS
: Normal normal
Target Milestone: 15.6
Assignee: Bugzilla
Depends on:
Reported: 2017-10-25 16:24 UTC by Chris Hamons
Modified: 2017-11-11 00:33 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Chris Hamons 2017-10-25 16:24:34 UTC
This objective-c code works:


but the animation sample here:


doesn't work, even as far back as XM 2.8.

I re-created it what I thought should work c#:


and it still isn't. Do we have an issue w\ the animator proxy?
Comment 1 Jon Goldberger [MSFT] 2017-10-26 01:13:51 UTC
I could make the sample work as expected by making one small change to the sample. Use SetValueForKey instead of SetValueForKeyPath in the setLineWidth method, e.g. replace:

> SetValueForKeyPath((NSNumber) value,(NSString)"drawnLineWidth");


> SetValueForKey((NSNumber) value,(NSString)"drawnLineWidth");

and then the line width animates as expected. 

I am not sure what the correct Key Path would be, if any would work. I tried animator.drawnLineWidth but that did not change anything. But it did not throw an exception, whereas Animator.drawnLineWidth threw a native exception, understandably since that definitely does not exist. 

So I will not change the status of this bug report in case this should work with a KeyPath.
Comment 2 Timothy Risi 2017-11-11 00:33:21 UTC
This looks like it's just the bug of needing to use Key instead of KeyPath that has already been fixed, not a bug in our bindings for KeyPath.  After reviewing Chris' working objective-c sample, it's not using setValue:forKey: OR setValue:forKeyPath:, it's simply setting  [self animator].DrawnLineWidth directly.  If I change the objective-c to call:

    [[self animator] setValue:[[NSNumber alloc] initWithInt:(int)([self.DrawnLineWidth integerValue] + 10)] forKeyPath:@"drawnLineWidth"];

I get the same behaviour as in the C# sample (no animation), but using 

    [[self animator] setValue:[[NSNumber alloc] initWithInt:(int)([self.DrawnLineWidth integerValue] + 10)] forKey:@"drawnLineWidth"];

animates correctly.