Page 1 of 1

Access Violation exception with TiltEffect (attached property/anim)

Posted: 10 May 2017, 02:24
by nokola
Edit: reproduces 100% with test project below on Android phone
I have a sample that works in WPF, but not in Noesis. It's the Windows Phone Tilt Effect ported to WPF. Project attached
e.g. something like: http://www.sharpgis.net/post/2012/03/02 ... Metro-XAML

1. Unzip TiltEffectCrash.zip: https://1drv.ms/u/s!AspGCVZdWgTBuvM9qBP2uS1Tqzc7sg
2. Run on Android phone
3. Tap one button -> get "target not found" exception but no crash
4. Try to tap different button

Expected:
button tilts back and forward

Actual:
button tilts halfway then crash:
Noesis.dll caused an Access Violation (0xc0000005)
in module Noesis.dll at 0033:c1c89502.

Opened bug: https://bugs.noesisengine.com/view.php?id=1075

Re: Access Violation exception with TiltEffect (attached property/anim)

Posted: 10 May 2017, 10:23
by nokola
updated repro steps above

Re: Access Violation exception with TiltEffect (attached property/anim)

Posted: 10 May 2017, 18:05
by sfernandez
Hi,

I found the source of the crash. We have a bug when Projection or RenderTransform properties are set to null, we will fix it for the next release.
You can workaround it by setting the identity:
private static void RevertPrepareControlForTilt(FrameworkElement element)
{
    element.ManipulationDelta -= TiltEffect_ManipulationDelta;
    element.ManipulationCompleted -= TiltEffect_ManipulationCompleted;
    element.Projection = Projection.Identity;
    element.RenderTransform = Transform.Identity;
}
Apart from that there is something wrong with the storyboard created in code, notifying the "Target not found" message, that I need to investigate more. I'll let you know.

Re: Access Violation exception with TiltEffect (attached property/anim)

Posted: 11 May 2017, 16:01
by nokola
Thanks, the crash workaround works!
Re: NoesisException: Target not found

It's baffling, when I comment out the StopStoryboard() in ResetTiltReturnStoryboard(), I don't get it. However, the effect doesn't work:
        private static void ResetTiltReturnStoryboard()
        {
            // tiltReturnStoryboard.StopStoryboard(); <------------------------ comment here
            wasPauseAnimation = false;
        }
This is the call stack for the exception here:
NoesisException: Target not found
Noesis.Error.Check ()
Noesis.View.Noesis_View_TouchDown_ (HandleRef view, Int32 x, Int32 y, UInt32 touchId)
Noesis.View.TouchDown (Int32 x, Int32 y, UInt32 touchId)
NoesisView.TouchDown (Int32 x, Int32 y, UInt32 touchId)
ImagePointerEvents.ProcessPendingInputEventsIfAny (Int32 maxProcessingTimeMs) <-- this is out function that just calls <NoesisView>.TouchDown(x, y, ...) with current mouse positions. The issue will repro without it as well.
ImagePointerEvents.Update ()

Thanks for the help! Any ideas on what might cause the above issue are greatly appreciated!