azchohfi / LottieUWP

UWP port of Lottie(https://github.com/airbnb/lottie-android)
Apache License 2.0
274 stars 45 forks source link

Compilation warning: LottieAnimationView.Loop is obsolete #41

Closed andrewdewaal closed 6 years ago

andrewdewaal commented 6 years ago

Our project compiles to treat warnings as errors. When compiling a project using a LottieAnimationView in a XAML view, the compiler shows the warning below: image This is reproducible using the sample project on this GitHub page by changing the project Debug settings to treat all warnings as errors. The property in question is found in LottieAnimationView, line 800. The documentation for this property refers to the RepeatCount property; would it be feasible to remove usages of the Loop property and replace them with RepeatCount? Many thanks!

azchohfi commented 6 years ago

The Loop property is still there only to avoid breaking code that is already using it, but I totally agree that it should be removed from the sample app. I'll send a PR.

andrewdewaal commented 6 years ago

Hi @azchohfi ; many thanks for the quick reply. Since this is marked as obsolete, is there a plan to release a version with the obsolete properties removed or the references to them within the package to be removed? For the time being, we can fork the project to make sure the references to the obsolete properties are removed for our usage. Thanks!

azchohfi commented 6 years ago

Is there a reason why you are building from source? If you use the NuGet package (https://www.nuget.org/packages/LottieUWP) and don't use any of the deprecated methods, you shouldn't get any warning, and therefore any errors.

andrewdewaal commented 6 years ago

We originally tried with the NuGet package, and that was where we first encountered this. The XAML for our test is as follows, using an animation from the sample project copied into our assets: <lottieUwp:LottieAnimationView FileName="Assets/Lottie/the_final_frontier.json" />

We have no code-behind attached to this view for the LottieAnimationView; it is purely XAML. Under these conditions, the warning is given at compile time.

azchohfi commented 6 years ago

I drilled down and this seems to be a problem with the generated code on XamlTypeInfo.g.cs. It is suppressing the warning only at Level0. For now, the only thing that can be done is either reducing the error level to 0, or manually suppressing 0612 for the project. I know it's not ideal... I will remove that property on a future version.

azchohfi commented 6 years ago

Ok, so I drilled with the responsible team for the XAML Markup Compiler and it seems that this bug only happens if the ObsoleteAttribute is used with the default message(i.e. [Obsolete], instead of [Obsolete("...")] ). I'm going to push this workaround for now, and they've already opened a bug internally to fix this for a future version of VS.

andrewdewaal commented 6 years ago

@azchohfi Excellent, thanks very much for the quick response and fix! Is there a time frame in which this change would be pushed as an update to the NuGet package?

azchohfi commented 6 years ago

You can already try the MyGet for now. No ETA on 2.6.0 final.