This is a migrated thread and some comments may be shown as answers.

TiltInteractionEffect throws NullReferenceException

5 Answers 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Grigory Perepechko
Top achievements
Rank 1
Grigory Perepechko asked on 08 Jan 2013, 12:31 PM
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;
    }
}

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 08 Jan 2013, 12:49 PM
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.
0
Grigory Perepechko
Top achievements
Rank 1
answered on 08 Jan 2013, 01:12 PM
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);                                                    
    }                                                                                               
}                       
0
Deyan
Telerik team
answered on 08 Jan 2013, 01:18 PM
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.
0
Grigory Perepechko
Top achievements
Rank 1
answered on 08 Jan 2013, 01:38 PM
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 ?


0
Deyan
Telerik team
answered on 08 Jan 2013, 01:55 PM
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.
Tags
General Discussions
Asked by
Grigory Perepechko
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Grigory Perepechko
Top achievements
Rank 1
Share this question
or