microsoft / XamlBehaviors

This is the official home for UWP XAML Behaviors on GitHub.
MIT License
697 stars 112 forks source link

Using EventTriggerBehavior for Pointer[Entered|Exited] triggers a crash in Microsoft.UI.Xaml.dll in UWP Release #184

Open Sergio0694 opened 4 years ago

Sergio0694 commented 4 years ago

Describe the bug Opening this issue here to mirror the one in WinUI, here: https://github.com/microsoft/microsoft-ui-xaml/issues/2256.

When running my app in Release mode, I get the following exception when hovering with the mouse over a template that uses some behaviors to trigger some animations. This is the exception:

Unhandled exception at 0x00007FFF1D7B2EC0 (Windows.UI.Xaml.dll) in WinUICrashRepro.exe: 0xC000027B: An internal exception occurrend in the application (parameters: 0x00000239CD4ADBE0, 0x0000000000000003).

I tried both with the 2.0.1 build and the 1.0.1 of the Microsoft.Xaml.Behaviors.Uwp.Managed package, same exact issue, in case this bit of information is of any help.

Also, as suggested by @ranjeshj, I've tried adding this to my .csproj file:

<EnableTypeInfoReflection>false</EnableTypeInfoReflection>

In order to repro the crash in Debug mode as well (in case this was similar to https://github.com/microsoft/microsoft-ui-xaml/issues/1949), but that didn't work. Even with this directive, Debug builds still work perfectly fine for me.

Steps to reproduce the bug

  1. Download this repro: WinUICrashRepro_2.zip
  2. Open the solution
  3. Run the app in Debug mode, and hover with the mouse on the template being displayed
  4. Notice how the app behaves normally and the animations all work fine
  5. Run the app in Release mode
  6. Notice how the app crashes as soon as you hover on the template

Expected behavior

The app should work in Release mode just like it does in Debug mode

Screenshots

UiBcn5RMdf

Version Info

NuGet package version:

Windows 10 version Saw the problem?
Insider Build (xxxxx)
November 2019 Update (18363) Yes
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT

Additional context

Looks like this issue might be related to the APIs in Microsoft.Xaml.Interactivity. In particular, the storyboard animations are triggered with these behaviors:

<interactivity:Interaction.Behaviors>
    <core:EventTriggerBehavior EventName="PointerEntered">
        <core:CallMethodAction TargetObject="{x:Bind StoryboardZoomIn}" MethodName="Begin"/>
    </core:EventTriggerBehavior>
    <core:EventTriggerBehavior EventName="PointerExited">
        <core:CallMethodAction TargetObject="{x:Bind StoryboardZoomOut}" MethodName="Begin"/>
    </core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>

Removing these lines removes the animations, but it also seems to prevent the issue from happening. Hopefully this might help a bit in investigating this issue.

Thank you for your time! 😄

premiaware commented 4 months ago

I have similar issue with EventTriggerBehavior this is my stack in AppCenter crash log,

image

have you found any solutions?