Bug 23581 - IllegalStateException when calling FadeTo in constructor of Forms control
Summary: IllegalStateException when calling FadeTo in constructor of Forms control
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: Normal critical
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-10-03 09:58 UTC by Rogier van der Hee
Modified: 2014-12-09 06:16 UTC (History)
4 users (show)

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

Recreation of my app (77.24 KB, application/x-zip-compressed)
2014-10-05 07:32 UTC, Rogier van der Hee

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 Rogier van der Hee 2014-10-03 09:58:12 UTC
Seen this on Android at least:

10-03 15:53:37.979 E/mono    (11878): Unhandled Exception:
10-03 15:53:37.979 E/mono    (11878): Java.Lang.IllegalStateException: Exception of type 'Java.Lang.IllegalStateException' was thrown.
10-03 15:53:37.979 E/mono    (11878):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
10-03 15:53:37.979 E/mono    (11878):   at Android.Runtime.JNIEnv.CallVoidMethod (IntPtr jobject, IntPtr jmethod) [0x00062] in /Users/builder/data/lanes/1131/2a7b6821/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:491 
10-03 15:53:37.979 E/mono    (11878):   at Android.Animation.Animator.Cancel () [0x00043] in /Users/builder/data/lanes/1131/2a7b6821/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Animation.Animator.cs:800 
10-03 15:53:37.979 E/mono    (11878):   at Xamarin.Forms.Platform.Android.AndroidTicker.DisableTimer () [0x00000] in <filename unknown>:0 
The program 'Mono' has exited with code 0 (0x0).

To replicate:
public SomeView()
            var image = new Image
                Aspect = Aspect.AspectFit,
                Source = "bla.png"
            image.FadeTo(0, 1);

The image has not been rendered yet, so it is logical that it crashes, but IMHO, it should give a better descriptive error message rather than crashing on the internal Android timer.
Comment 1 Rogier van der Hee 2014-10-03 09:59:38 UTC
If you call this in the constructor, perhaps give a nice error message saying: use control.Opacity or something.
Comment 2 Jason Smith [MSFT] 2014-10-03 10:12:53 UTC
Will look into, this shouldn't crash at all really.
Comment 3 Arpit Jha 2014-10-03 11:02:58 UTC
I have checked this issue and unable to reproduce it.

I tried following steps to reproduce it.
1.Create a Xamarin forms appn.
2.Add a class (Someview.cs)
3.Did some code in SOmeview.cs
public class SomeView : ContentPage

      public SomeView()

          var image = new Image
              Aspect = Aspect.AspectFit,
              Source = "waterfront.jpg"
          image.FadeTo(0, 1);

4.Call Somebiew.cs in App.cs.
5.Run the application.

I observed that application does not crash and getting a blanck  output.

Let me know if I missed anything to reproduce it.

Screencast regarding same :
Environment Info:
VS 2013 Update 3
Comment 4 Rogier van der Hee 2014-10-05 07:32:10 UTC
Created attachment 8309 [details]
Recreation of my app
Comment 5 Rogier van der Hee 2014-10-05 07:33:24 UTC
I tried to reproduce it myself, and the attached app is the closest I came to isolating the situation. But this does not produce the error, and in my app I could trigger it over multiple image views in multiple controls consistently.
Comment 6 Jason Smith [MSFT] 2014-12-09 06:16:32 UTC
Fixed in next pre-release