向故事板添加 RepeatBehavior 和 Duration 时出现 Wasm 异常

Wasm Exception when adding a RepeatBehavior and a Duration to a Storyboard

我正在尝试使用 VisualStates 和故事板在 WebAssembly 中显示一个简单的闪烁动画。将 Duration 和 RepeatBehavior='Forever' 添加到 Storyboard 时出现以下异常:

    Error
    at 631680 (dotnet.js:1)
    at _emscripten_asm_const_iii (dotnet.js:1)
    at wasm_logger (:58006/<anonymous>:wasm-function[3132]:0x9dfb7)
    at eglib_log_adapter (:58006/<anonymous>:wasm-function[6071]:0x112d92)
    at monoeg_g_logstr (:58006/<anonymous>:wasm-function[4608]:0xcd55a)
    at monoeg_g_logv_nofree (:58006/<anonymous>:wasm-function[2196]:0x63d92)
    at monoeg_assertion_message (:58006/<anonymous>:wasm-function[429]:0xd35c)
    at mono_assertion_message_unreachable (:58006/<anonymous>:wasm-function[144]:0x347c)
    at interp_exec_method (:58006/<anonymous>:wasm-function[1380]:0x2fa40)
    at interp_runtime_invoke (:58006/<anonymous>:wasm-function[5695]:0xfb19a)

Uno.UI.js:97 Unhandled dispatcher exception: RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info. (RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info.
    at abort (http://localhost:58006/package_e0b2677001d484af549b92b1436e81abf6d3eb6b/dotnet.js:1:16059)
    at _abort (http://localhost:58006/package_e0b2677001d484af549b92b1436e81abf6d3eb6b/dotnet.js:1:117947)
    at wasm_logger (<anonymous>:wasm-function[3132]:0x9dfd9)
    at eglib_log_adapter (<anonymous>:wasm-function[6071]:0x112d92)
    at monoeg_g_logstr (<anonymous>:wasm-function[4608]:0xcd55a)
    at monoeg_g_logv_nofree (<anonymous>:wasm-function[2196]:0x63d92)
    at monoeg_assertion_message (<anonymous>:wasm-function[429]:0xd35c)
    at mono_assertion_message_unreachable (<anonymous>:wasm-function[144]:0x347c)
    at interp_exec_method (<anonymous>:wasm-function[1380]:0x2fa40)
    at interp_runtime_invoke (<anonymous>:wasm-function[5695]:0xfb19a))

Uno.UI.js:98 Uncaught RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info.
    at abort (http://localhost:58006/package_e0b2677001d484af549b92b1436e81abf6d3eb6b/dotnet.js:1:16059)
    at _abort (http://localhost:58006/package_e0b2677001d484af549b92b1436e81abf6d3eb6b/dotnet.js:1:117947)
    at wasm_logger (<anonymous>:wasm-function[3132]:0x9dfd9)
    at eglib_log_adapter (<anonymous>:wasm-function[6071]:0x112d92)
    at monoeg_g_logstr (<anonymous>:wasm-function[4608]:0xcd55a)
    at monoeg_g_logv_nofree (<anonymous>:wasm-function[2196]:0x63d92)
    at monoeg_assertion_message (<anonymous>:wasm-function[429]:0xd35c)
    at mono_assertion_message_unreachable (<anonymous>:wasm-function[144]:0x347c)
    at interp_exec_method (<anonymous>:wasm-function[1380]:0x2fa40)
    at interp_runtime_invoke (<anonymous>:wasm-function[5695]:0xfb19a)

Uno.UI.js:97 Unhandled dispatcher exception: RuntimeError: memory access out of bounds (RuntimeError: memory access out of bounds
    at malloc (<anonymous>:wasm-function[359]:0xa47e)
    at monoeg_malloc (<anonymous>:wasm-function[161]:0x3e0f)
    at mono_mempool_new_size (<anonymous>:wasm-function[629]:0x12bce)
    at generate (<anonymous>:wasm-function[5909]:0x107b81)
    at mono_interp_transform_method (<anonymous>:wasm-function[1290]:0x2b57b)
    at do_transform_method (<anonymous>:wasm-function[2959]:0x93ac4)
    at interp_exec_method (<anonymous>:wasm-function[1380]:0x2eda7)
    at interp_runtime_invoke (<anonymous>:wasm-function[5695]:0xfb19a)
    at mono_jit_runtime_invoke (<anonymous>:wasm-function[5149]:0xe196b)
    at do_runtime_invoke (<anonymous>:wasm-function[1411]:0x3ea94))

Uno.UI.js:98 Uncaught RuntimeError: memory access out of bounds
    at malloc (<anonymous>:wasm-function[359]:0xa47e)
    at monoeg_malloc (<anonymous>:wasm-function[161]:0x3e0f)
    at mono_mempool_new_size (<anonymous>:wasm-function[629]:0x12bce)
    at generate (<anonymous>:wasm-function[5909]:0x107b81)
    at mono_interp_transform_method (<anonymous>:wasm-function[1290]:0x2b57b)
    at do_transform_method (<anonymous>:wasm-function[2959]:0x93ac4)
    at interp_exec_method (<anonymous>:wasm-function[1380]:0x2eda7)
    at interp_runtime_invoke (<anonymous>:wasm-function[5695]:0xfb19a)
    at mono_jit_runtime_invoke (<anonymous>:wasm-function[5149]:0xe196b)
    at do_runtime_invoke (<anonymous>:wasm-function[1411]:0x3ea94)

dotnet.js:1 Thread 0x1 may have been prematurely finalized* Assertion at /__w/1/s/mono/mono/utils/mono-threads.c:702, condition `<disabled>' not met
Uno.UI.js:97 Unhandled dispatcher exception: [object Object] (undefined)

Uno.UI.js:98 Uncaught ExitStatus {name: "ExitStatus", message: "Program terminated with exit(0)", status: 0}

dotnet.js:1 * Assertion: should not be reached at /__w/1/s/mono/mono/utils/mono-threads-coop.h:48
dotnet.js:1 Uncaught ExitStatus {name: "ExitStatus", message: "Program terminated with exit(0)", status: 0}

dotnet.js:1 * Assertion at /__w/1/s/mono/mono/utils/mono-internal-hash.c:47, condition `<disabled>' not met
dotnet.js:1 Uncaught ExitStatus {name: "ExitStatus", message: "Program terminated with exit(0)", status: 0}

导致上述错误的xaml是:

<Grid Background="White" BorderBrush="Gray" BorderThickness="1" Width="250" Height="250">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="LightStates">
            <VisualState x:Name="LightFlashing">
                <Storyboard Duration="0:0:2.0" RepeatBehavior="Forever">
                    <DoubleAnimation From="1" To="0" Storyboard.TargetName="AnimatedEllipse" Storyboard.TargetProperty="Opacity" />
                </Storyboard>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

    <Ellipse x:Name="AnimatedEllipse" Height="126" Width="126">
        <Ellipse.Fill>
            <SolidColorBrush x:Name="AnimatedEllipseBrush" Color="Red" />
        </Ellipse.Fill>
    </Ellipse>
</Grid>

从 Storyboard 中删除 Duration 并将其添加到 DoubleAnimation 工作正常,没有错误。 Uno.Wasm.Bootstrap 版本为 1.3.0-dev.44

这是 Uno 平台中的一个错误,我已经为它创建了一个问题 on GitHub。同样的问题可能会出现在所有目标上,如您所述,修复之前的解决方法是将 Duration 属性保留在 DoubleAnimation 上。感谢报告!