TiltInteractionEffect throws NullReferenceException

6 posts, 0 answers
  1. Grigory Perepechko
    Grigory Perepechko avatar
    27 posts
    Member since:
    Aug 2009

    Posted 08 Jan 2013 Link to this post

    Hi,

    I navigate back from some page and on destination page start swiping quite fast. Under my finger there are button controls with tilt effect attached.

    Stacktrace: http://screencast.com/t/OYBsSIkvA

    Issue reproduced in debug: https://www.dropbox.com/s/kku242wkrdn5qhf/TeleriksStackTrace.png

    Workaround for me 
    private void HandleException(ApplicationUnhandledExceptionEventArgs e)
    {
        bool isTiltBug = e.ExceptionObject is NullReferenceException
                         && e.ExceptionObject.StackTrace.Contains("TiltInteractionEffect");
        if (isTiltBug)
        {
            e.Handled = true;
            return;
        }
    }
  2. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 08 Jan 2013 Link to this post

    Hello Grigory,

    Thanks for writing and for reporting this issue.

    We are currently not aware of similar issues. Can you please prepare a sample project that we can use to reproduce them on our side and see what causes them?

    Thanks for your time.

    Greetings,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Grigory Perepechko
    Grigory Perepechko avatar
    27 posts
    Member since:
    Aug 2009

    Posted 08 Jan 2013 Link to this post

    Hi Deyan,

    Im very sorry, but im lack of time :( I would have to make a code huge regression to prepare isolated bug repro.
    I've added workaround for all people who encounter this issue, hope this will save some time for them.

    Im not very familiar with this TiltEffect, but what i see in code is that context is created in BeginTilting which is called in OnStartEffect which is called in OnManipulationStarted


    internal void OnManipulationStarted(FrameworkElement targetElement, ManipulationStartedEventArgs args
    {                                                                                                   
        if (this.CanStartEffect(targetElement, args))                                                   
        {                                                                                               
            this.OnStartEffect(targetElement, args);                                                    
        }                                                                                               
    }                                                                                                   


    So there we see a chance that OnStart wouldn't be called and context will retain null.

    So getting NullReferecnceException in  OnManipulationDelta  seems quite logical. Look:

    partial void OnElementManipulationDelta(object sender, RoutedEventArgs args)                                                                
    {                     
        // We will get exception here                                                                                                                     
        FrameworkElement targetElement = this.currentTiltContext.TargetElement;                                                                 
         
     
        // Some other code was cut out                                                                                                                                   
    }                                                                                                                                           




                                                                                                        

    internal void OnManipulationStarted(FrameworkElement targetElement, ManipulationStartedEventArgs args
    {                                                                                                   
        if (this.CanStartEffect(targetElement, args))                                                   
        {                                                                                               
            this.OnStartEffect(targetElement, args);                                                    
        }                                                                                               
    }                       
    internal void OnManipulationStarted(FrameworkElement targetElement, ManipulationStartedEventArgs args
    {                                                                                                   
        if (this.CanStartEffect(targetElement, args))                                                   
        {                                                                                               
            this.OnStartEffect(targetElement, args);                                                    
        }                                                                                               
    }                       
  5. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 08 Jan 2013 Link to this post

    Hello Grigory,

    Can you then paste here the XAML code of your Main page where the exception occurs?

    Are you using a ScrollViewer component in which you are putting the controls that have the Tilt effect?

    Thanks for your time.

    All the best,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  6. Grigory Perepechko
    Grigory Perepechko avatar
    27 posts
    Member since:
    Aug 2009

    Posted 08 Jan 2013 Link to this post

    Hi again,

    Full xaml is strongly divided to subcontrols

    Schematically it is like that 

    Page
        Grid
            Panorama te:InteractionEffectManager.IsInteractionEnabled="True"
                PanoramaItem1
                    ItemsControl
                        Button
                        Button
                        Button
                        Button
                PanoramaItem2
                    ItemsControl
                        Button
                        Button
                        Button
                        Button
                PanoramaItem3
                    ScrollViewer
                        ItemsControl
                            Button
                            Button
                            Button
                            Button
                            Button
                            Button
                            Button
                            Button

    One more detail about crash. ManipulationDelta OriginalSource is Border control inside Microsoft.Phone.Controls.Primitives.PanningBackgroundLayer. Probably issue is reproducible only on loading Panorama and Pivot controls.

    Probably im wrong when i set te:InteractionEffectManager.IsInteractionEnabled="True" on Panorama ?


  7. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 08 Jan 2013 Link to this post

    Hello Grigory,

    Thanks for writing back.

    Can you try setting the IsInteractionEnabled property to true on the buttons themselves and let me know if it solves the exception?

    All the best,
    Deyan
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top
DevCraft banner