Skip to content

[wasm][AOT] Rgba32 decode hangs or traps unless generic pixel operation is directly rooted #130545

Description

@littletoxic

Description

A Blazor WebAssembly Release AOT build either traps with MONO_WASM: function signature mismatch or hangs while ImageSharp 4.0.0 decodes a PNG into Rgba32.

The strongest indication that this is a Mono WASM AOT generic-instantiation/codegen issue is that merely adding a reachable direct call to PixelOperations<Rgba32>.FromRgba32Bytes makes the previously failing Image.LoadAsync<Rgba32> complete. No PNG data or decoder configuration changes between the failing and working builds.

Library-side tracking with the full diagnosis is SixLabors/ImageSharp#3151.

Reproduction Steps

Clone:

git clone https://github.com/littletoxic/ImageConverterWasm.git
cd ImageConverterWasm

The app uses ImageSharp 4.0.0, which performs build-time license validation. A valid local open-source/commercial license is therefore required to build the v4 dependency. The reporter cannot publish that license. The ImageSharp maintainers can reproduce from SixLabors/ImageSharp#3151.

Publish with WASM AOT enabled:

dotnet publish .\src\ImageConverter\ImageConverter.csproj `
  -c Release `
  -p:RunAOTCompilation=true `
  -p:PublishDir="$env:TEMP\ImageConverterAot\"

dotnet serve --directory "$env:TEMP\ImageConverterAot\wwwroot"

Open the printed URL and upload:

https://github.com/littletoxic/ImageConverterWasm/blob/main/src/ImageConverter/wwwroot/favicon.png

The original app calls:

_image = await Image.LoadAsync(stream);

More focused diagnostic builds established:

// Hangs
using var rgbaImage = await Image.LoadAsync<Rgba32>(stream);

// Completes for the same RGBA PNG
using var rgbImage = await Image.LoadAsync<Rgb24>(stream);

The inverse control also hangs: an RGB PNG that normally completes hangs when explicitly decoded using Image.LoadAsync<Rgba32>.

These calls complete independently:

_ = new Image<Rgba32>(32, 32);

var source = new byte[4];
var destination = new Rgba32[1];
PixelOperations<Rgba32>.Instance.FromRgba32Bytes(
    Configuration.Default,
    source,
    destination,
    destination.Length);

Most importantly, keeping the direct FromRgba32Bytes call reachable in the application also makes the formerly hanging Image.LoadAsync<Rgba32> call complete. This changes the AOT generic instance set without changing the decoded input.

Expected behavior

Image.LoadAsync<Rgba32> should decode the 32x32 PNG and return normally in a Release WASM AOT build.

Actual behavior

With the original browser file stream, the runtime traps:

MONO_WASM: function signature mismatch
RuntimeError: function signature mismatch
    at dotnet.native.wasm:wasm-function[...]

After buffering the browser stream into a MemoryStream, the focused Image.LoadAsync<Rgba32> diagnostic hangs indefinitely before returning. Depending on which generic calls are reachable, the symptom changes between a signature-mismatch trap and a hang.

Rgb24 and several other pixel/format controls complete normally.

Regression?

ImageSharp 3.1.12 completes the same explicit Image.LoadAsync<Rgba32> test on the same .NET SDK/workload. ImageSharp 4.0.0 does not.

A relevant library code-shape change is:

  • ImageSharp 3: the generic pixel loop calls the mutable struct instance method dp.FromRgba32(sp).
  • ImageSharp 4: the loop uses the static abstract interface call TPixel.FromRgba32(...).

This establishes a library-version regression surface but does not by itself prove which runtime change is responsible.

Known Workarounds

Either:

  1. Decode into Rgb24 when dropping alpha is acceptable, or
  2. Keep a reachable direct call to PixelOperations<Rgba32>.Instance.FromRgba32Bytes(...) in the application so the required AOT instance appears to be generated.

Disabling RunAOTCompilation also avoids the AOT-specific failure.

Configuration

.NET SDK:       11.0.100-preview.5.26302.115
Runtime:        11.0.0-preview.5.26302.115
WASM workload:  11.0.100-preview.5.26302.115
OS:             Windows 10.0.26200 x64
Browser:        Microsoft Edge
ImageSharp:     4.0.0

AOT publish succeeds and reports AOT'ing 48 assemblies; the failure occurs only when the browser executes the decode path.

Other information

Related issues:

Attempts to reduce the issue to only a static-abstract-interface generic loop, including a cross-assembly version, completed normally. Therefore the report does not claim that static abstract dispatch alone is sufficient; an additional ImageSharp dispatch/instantiation condition is involved.


This issue was investigated and prepared with assistance from OpenAI Codex.

Activity

  1. self-assigned this
    on Jul 19, 2026
  2. added this to the 11.0.0 milestone on Jul 20, 2026
  3. removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 20, 2026
  4. pavelsavara commented on Aug 4, 2026

    @pavelsavara
    Member

    @littletoxic does this have same symptoms with Net10 as with Net11 ? (wipe bin/obj folders before you recompile)

    I wonder why #119004 on Net11 doesn't fix this.

    @BrzVlad thoughts ?

  5. pavelsavara commented on Aug 4, 2026

    @pavelsavara
    Member

    Or maybe it cold be fixed by @lewing's #131049 in Net11 preview 7, but I'm not sure because PixelOperations is a class not struct.

  6. BrzVlad commented on Aug 4, 2026

    @BrzVlad
    Member

    invalid function signature, presence of static abstract interface calls, repro being affected by presence of unrelated methods -> to me it points to some issue around resolving of method. So I imagine somwhere there is a call that gets resolved incorrectly either at compiled time or at runtime. Example of a fix for such a issue #131219, which might be related. Your case might be reabstraction for static virtuals though, which should be statically known. I believe we might not have all the static virtual tests enabled for mono, so might be useful to double check there first.

  7. littletoxic commented on Aug 4, 2026

    @littletoxic
    Author

    Yes. I reproduced the same signature-mismatch trap on .NET 10 after deleting the reproduction project's bin and obj directories immediately before publishing.

    Environment:

    .NET SDK: 10.0.302
    Runtime / WASM packs: 10.0.10
    Target framework: net10.0
    ImageSharp: 4.0.0
    Browser: Microsoft Edge
    

    This is a standalone Blazor WebAssembly reproduction containing only a button which loads the same 32x32 RGBA PNG into a MemoryStream and calls:

    Console.WriteLine("REPRO: before Image.LoadAsync<Rgba32>");
    using var image = await Image.LoadAsync<Rgba32>(stream);
    Console.WriteLine("REPRO: after Image.LoadAsync<Rgba32>");

    The AOT publish succeeds and reports AOT'ing 40 assemblies. At runtime, the before marker is printed, followed by:

    MONO_WASM: function signature mismatch
    RuntimeError: function signature mismatch
    

    The after marker is never printed.

    So .NET 10 also reproduces the trap symptom. In this minimal code shape it traps rather than hanging, consistent with the original report where small reachability/stream changes switch the symptom between a trap and a hang.

    I haven't retested .NET 11 Preview 7 yet. I have the standalone reproduction ready locally and can publish it as a branch of the linked repository if that would help.

  8. pavelsavara commented on Aug 4, 2026

    @pavelsavara
    Member

    I can reproduce with latest main, here is dump with symbols

    dotnet.s56c8v7kkt.js:144 MONO_WASM: function signature mismatch
    RuntimeError: function signature mismatch
    $SixLabors_ImageSharp_SixLabors_ImageSharp_PixelFormats_PixelOperations_1_TPixel_GSHAREDVT__cctor (dotnet.native.uetu18avbv.wasm:0x602fdf)
    $aot_instances_aot_wrapper_gsharedvt_out_sig_void_ (dotnet.native.uetu18avbv.wasm:0xe89bde)
    $aot_instances_wrapper_runtime_invoke_object_runtime_invoke_sig_void_intptr_object_intptr_intptr_intptr (dotnet.native.uetu18avbv.wasm:0x14a7258)
    mono_llvmonly_runtime_invoke (mini-runtime.c:3431)
    mono_jit_runtime_invoke (mini-runtime.c:3695)
    do_runtime_invoke (object.c:2579)
    mono_runtime_try_invoke (object.c:2736)
    mono_runtime_class_init_full (object.c:547)
    init_method (aot-runtime.c:4894)
    mono_aot_init_llvm_method (aot-runtime.c:4924)
    mini_llvm_init_method (llvmonly-runtime.c:946)
    $mono_aot_SixLabors_ImageSharp_init_method_gshared_mrgctx (dotnet.native.uetu18avbv.wasm:0x38cccd)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_PixelFormats_PixelOperations_1_TPixel_GSHAREDVT_get_Instance (dotnet.native.uetu18avbv.wasm:0x6022e5)
    $aot_instances_aot_wrapper_gsharedvt_out_sig_obj_ (dotnet.native.uetu18avbv.wasm:0xe8bd29)
    jit_call_cb (interp.c:2584)
    ::mono_llvm_cpp_catch_exception(MonoLLVMInvokeCallback, gpointer, gboolean *) (llvm-runtime.cpp:46)
    mono_llvm_catch_exception (mini-exceptions.c:3734)
    do_jit_call (interp.c:2919)
    method_entry (interp.c:4568)
    mono_interp_exec_method (interp.c:4080)
    interp_entry (interp.c:2372)
    interp_entry_instance_6 (interp.c:3184)
    $aot_instances_aot_wrapper_gsharedvt_in_sig_void_this_cl39_SixLabors_dImageSharp_dFormats_dPng_dChunks_dFrameControl_objobjobjobjcl1d_Mono_dValueTuple_601_3cint_3e_ (dotnet.native.uetu18avbv.wasm:0x1103a42)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_Png_PngDecoderCore__c__DisplayClass35_0_1_TPixel_GSHAREDVT__DecodePixelDatab__0 (dotnet.native.uetu18avbv.wasm:0x635ae4)
    $corlib_wrapper_delegate_invoke__Module_invoke_void (dotnet.native.uetu18avbv.wasm:0xdcfcf4)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_ImageDecoderCore_ExecuteImageDataSegmentAction_System_Action (dotnet.native.uetu18avbv.wasm:0x45e37e)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_Png_PngDecoderCore_DecodePixelData_TPixel_GSHAREDVT_SixLabors_ImageSharp_Formats_Png_Chunks_FrameControl_System_IO_Compression_DeflateStream_SixLabors_ImageSharp_ImageFrame_1_TPixel_GSHAREDVT_SixLabors_ImageSharp_Formats_Png_PngMetadata_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x63543e)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_Png_PngDecoderCore_ReadScanlines_TPixel_GSHAREDVT_int_SixLabors_ImageSharp_ImageFrame_1_TPixel_GSHAREDVT_SixLabors_ImageSharp_Formats_Png_PngMetadata_System_Func_1_int_SixLabors_ImageSharp_Formats_Png_Chunks_FrameControl__System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x635036)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_Png_PngDecoderCore_Decode_TPixel_GSHAREDVT_SixLabors_ImageSharp_IO_BufferedReadStream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x6343f2)
    $aot_instances_SixLabors_ImageSharp_Formats_ImageDecoderCore_Decode_SixLabors_ImageSharp_PixelFormats_Rgba32_SixLabors_ImageSharp_Configuration_System_IO_Stream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x11095e4)
    $aot_instances_SixLabors_ImageSharp_Formats_Png_PngDecoder_Decode_SixLabors_ImageSharp_PixelFormats_Rgba32_SixLabors_ImageSharp_Formats_Png_PngDecoderOptions_System_IO_Stream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x105ee5e)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_Png_PngDecoder_Decode_SixLabors_ImageSharp_Formats_Png_PngDecoderOptions_System_IO_Stream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x520b27)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_SpecializedImageDecoder_1_T_REF_Decode_SixLabors_ImageSharp_Formats_DecoderOptions_System_IO_Stream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x45f43b)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_ImageDecoder__c__DisplayClass3_0__DecodeAsyncb__0_System_IO_Stream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x45c925)
    $aot_instances_wrapper_delegate_invoke_System_Func_3_System_IO_Stream_System_Threading_CancellationToken_SixLabors_ImageSharp_Image_invoke_TResult_T1_T2_System_IO_Stream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x1094869)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_ImageDecoder__c__DisplayClass12_0_1_T_REF__WithSeekableMemoryStreamAsyncg__PerformActionAndResetPosition_0_System_IO_Stream_long_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x45c5ff)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_ImageDecoder_WithSeekableMemoryStreamAsync_T_REF_SixLabors_ImageSharp_Formats_DecoderOptions_System_IO_Stream_System_Func_3_System_IO_Stream_System_Threading_CancellationToken_T_REF_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x45b9a2)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_ImageDecoder__DecodeAsyncd__3_MoveNext (dotnet.native.uetu18avbv.wasm:0x45dd3e)
    $corlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_Start_TStateMachine_GSHAREDVT_TStateMachine_GSHAREDVT_ (dotnet.native.uetu18avbv.wasm:0xda6345)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Formats_ImageDecoder_DecodeAsync_SixLabors_ImageSharp_Formats_DecoderOptions_System_IO_Stream_System_Threading_CancellationToken (dotnet.native.uetu18avbv.wasm:0x45b01c)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Image__DecodeAsyncd__51_MoveNext (dotnet.native.uetu18avbv.wasm:0x3bf989)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_ExecutionContextCallback_object (dotnet.native.uetu18avbv.wasm:0xda7117)
    $corlib_wrapper_delegate_invoke__Module_invoke_void_object_object (dotnet.native.uetu18avbv.wasm:0xdd2840)
    $corlib_System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object (dotnet.native.uetu18avbv.wasm:0xc7f53e)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext_System_Threading_Thread_System_Runtime_CompilerServices_AsyncInstrumentation_Flags (dotnet.native.uetu18avbv.wasm:0xda7715)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext_System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xda75ec)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext (dotnet.native.uetu18avbv.wasm:0xda7587)
    $corlib_System_Threading_Tasks_AwaitTaskContinuation_RunOrScheduleAction_System_Runtime_CompilerServices_IAsyncStateMachineBox_bool (dotnet.native.uetu18avbv.wasm:0xcb21d9)
    $corlib_System_Threading_Tasks_Task_RunContinuations_object (dotnet.native.uetu18avbv.wasm:0xcb18da)
    $corlib_System_Threading_Tasks_Task_FinishContinuations (dotnet.native.uetu18avbv.wasm:0xca917e)
    $corlib_System_Threading_Tasks_Task_1_TResult_REF_TrySetResult_TResult_REF (dotnet.native.uetu18avbv.wasm:0xca8f93)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_TResult_REF_SetExistingTaskResult_System_Threading_Tasks_Task_1_TResult_REF_TResult_REF (dotnet.native.uetu18avbv.wasm:0xcd6ce7)
    $corlib_System_Runtime_CompilerServices_AsyncValueTaskMethodBuilder_1_TResult_REF_SetResult_TResult_REF (dotnet.native.uetu18avbv.wasm:0xcd7c7c)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Image__DiscoverDecoderAsyncd__47_MoveNext (dotnet.native.uetu18avbv.wasm:0x3bff8f)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_ExecutionContextCallback_object (dotnet.native.uetu18avbv.wasm:0xda7117)
    $corlib_wrapper_delegate_invoke__Module_invoke_void_object_object (dotnet.native.uetu18avbv.wasm:0xdd2840)
    $corlib_System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object (dotnet.native.uetu18avbv.wasm:0xc7f53e)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext_System_Threading_Thread_System_Runtime_CompilerServices_AsyncInstrumentation_Flags (dotnet.native.uetu18avbv.wasm:0xda7715)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext_System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xda75ec)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext (dotnet.native.uetu18avbv.wasm:0xda7587)
    $corlib_System_Threading_Tasks_AwaitTaskContinuation_RunOrScheduleAction_System_Runtime_CompilerServices_IAsyncStateMachineBox_bool (dotnet.native.uetu18avbv.wasm:0xcb21d9)
    $corlib_System_Threading_Tasks_Task_RunContinuations_object (dotnet.native.uetu18avbv.wasm:0xcb18da)
    $corlib_System_Threading_Tasks_Task_FinishContinuations (dotnet.native.uetu18avbv.wasm:0xca917e)
    $corlib_System_Threading_Tasks_Task_1_TResult_REF_TrySetResult_TResult_REF (dotnet.native.uetu18avbv.wasm:0xca8f93)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_TResult_REF_SetExistingTaskResult_System_Threading_Tasks_Task_1_TResult_REF_TResult_REF (dotnet.native.uetu18avbv.wasm:0xcd6ce7)
    $corlib_System_Runtime_CompilerServices_AsyncValueTaskMethodBuilder_1_TResult_REF_SetResult_TResult_REF (dotnet.native.uetu18avbv.wasm:0xcd7c7c)
    $SixLabors_ImageSharp_SixLabors_ImageSharp_Image__InternalDetectFormatAsyncd__44_MoveNext (dotnet.native.uetu18avbv.wasm:0x3c0c6a)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_ExecutionContextCallback_object (dotnet.native.uetu18avbv.wasm:0xda7117)
    $corlib_wrapper_delegate_invoke__Module_invoke_void_object_object (dotnet.native.uetu18avbv.wasm:0xdd2840)
    $corlib_System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object (dotnet.native.uetu18avbv.wasm:0xc7f53e)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext_System_Threading_Thread_System_Runtime_CompilerServices_AsyncInstrumentation_Flags (dotnet.native.uetu18avbv.wasm:0xda7715)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext_System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xda75ec)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_GSHAREDVT_TStateMachine_GSHAREDVT_MoveNext (dotnet.native.uetu18avbv.wasm:0xda7587)
    $corlib_System_Threading_Tasks_AwaitTaskContinuation_RunOrScheduleAction_System_Runtime_CompilerServices_IAsyncStateMachineBox_bool (dotnet.native.uetu18avbv.wasm:0xcb21d9)
    $corlib_System_Threading_Tasks_Task_RunContinuations_object (dotnet.native.uetu18avbv.wasm:0xcb18da)
    $corlib_System_Threading_Tasks_Task_FinishContinuations (dotnet.native.uetu18avbv.wasm:0xca917e)
    $aot_instances_System_Threading_Tasks_Task_1_TResult_INT_TrySetResult_TResult_INT (dotnet.native.uetu18avbv.wasm:0xf2f4a1)
    $aot_instances_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_TResult_INT_SetExistingTaskResult_System_Threading_Tasks_Task_1_TResult_INT_TResult_INT (dotnet.native.uetu18avbv.wasm:0xfbccc9)
    $aot_instances_System_Runtime_CompilerServices_AsyncValueTaskMethodBuilder_1_TResult_INT_SetResult_TResult_INT (dotnet.native.uetu18avbv.wasm:0xfb4c48)
    $corlib_System_IO_Stream___ReadAsyncg__FinishReadAsync_44_0d_MoveNext (dotnet.native.uetu18avbv.wasm:0xd2901e)
    $aot_instances_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_INT_TStateMachine_REF_ExecutionContextCallback_object (dotnet.native.uetu18avbv.wasm:0xfbf47c)
    $corlib_wrapper_delegate_invoke__Module_invoke_void_object_object (dotnet.native.uetu18avbv.wasm:0xdd2840)
    $corlib_System_Threading_ExecutionContext_RunInternal_System_Threading_ExecutionContext_System_Threading_ContextCallback_object (dotnet.native.uetu18avbv.wasm:0xc7f53e)
    $aot_instances_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_INT_TStateMachine_REF_MoveNext_System_Threading_Thread_System_Runtime_CompilerServices_AsyncInstrumentation_Flags (dotnet.native.uetu18avbv.wasm:0xfbfaf4)
    $aot_instances_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_INT_TStateMachine_REF_MoveNext_System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xfbf979)
    $aot_instances_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_1_AsyncStateMachineBox_1_TResult_INT_TStateMachine_REF_MoveNext (dotnet.native.uetu18avbv.wasm:0xfbf909)
    $corlib_System_Threading_Tasks_AwaitTaskContinuation_RunOrScheduleAction_System_Runtime_CompilerServices_IAsyncStateMachineBox_bool (dotnet.native.uetu18avbv.wasm:0xcb21d9)
    $corlib_System_Threading_Tasks_Task_RunContinuations_object (dotnet.native.uetu18avbv.wasm:0xcb18da)
    $corlib_System_Threading_Tasks_Task_FinishContinuations (dotnet.native.uetu18avbv.wasm:0xca917e)
    $corlib_System_Threading_Tasks_Task_FinishStageThree (dotnet.native.uetu18avbv.wasm:0xcae665)
    $corlib_System_Threading_Tasks_Task_FinishStageTwo (dotnet.native.uetu18avbv.wasm:0xcadc1b)
    $corlib_System_Threading_Tasks_Task_Finish_bool (dotnet.native.uetu18avbv.wasm:0xcada52)
    $corlib_System_Threading_Tasks_Task_ExecuteWithThreadLocal_System_Threading_Tasks_Task__System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xcaf0ae)
    $corlib_System_Threading_Tasks_Task_ExecuteEntryUnsafe_System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xcaf40f)
    $corlib_System_Threading_Tasks_Task_ExecuteDirectly_System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xcaf305)
    $corlib_System_Threading_ThreadPoolWorkQueue_DispatchWorkItem_object_System_Threading_Thread (dotnet.native.uetu18avbv.wasm:0xc9d221)
    $corlib_System_Threading_ThreadPoolWorkQueue_Dispatch (dotnet.native.uetu18avbv.wasm:0xc9cfb8)
    $corlib_System_Threading_ThreadPool_BackgroundJobHandler (dotnet.native.uetu18avbv.wasm:0xc9efc2)
    $corlib_wrapper_native_to_managed_System_Threading_ThreadPool_BackgroundJobHandler (dotnet.native.uetu18avbv.wasm:0xdda226)
    mono_background_exec (mono-threads-wasm.c:366)
    mono_background_exec_until_done (dotnet.runtime.k71s9ljcgk.js:8001)
    callUserCallback (dotnet.native.r5qpjhb7rz.js:4718)
    (anonymous) (dotnet.native.r5qpjhb7rz.js:4738)
    setTimeout
    safeSetTimeout (dotnet.native.r5qpjhb7rz.js:4736)
    SystemJS_ScheduleBackgroundJobImpl (dotnet.runtime.k71s9ljcgk.js:8012)
    SystemJS_ScheduleBackgroundJob (mono-threads-wasm.c:333)
    $aot_wrapper_corlib_System_dot_Threading_System_dot_Threading_dot_ThreadPool__MainThreadScheduleBackgroundJob_pinvoke_void_cl7_void_2a_void_cl7_void_2a_ (dotnet.native.uetu18avbv.wasm:0xc9ee9a)
    $corlib_System_Threading_ThreadPool_EnsureWorkerRequested (dotnet.native.uetu18avbv.wasm:0xc9b26a)
    $corlib_System_Threading_ThreadPoolWorkQueue_Dispatch (dotnet.native.uetu18avbv.wasm:0xc9ce02)
    $corlib_System_Threading_ThreadPool_BackgroundJobHandler (dotnet.native.uetu18avbv.wasm:0xc9efc2)
    $corlib_wrapper_native_to_managed_System_Threading_ThreadPool_BackgroundJobHandler (dotnet.native.uetu18avbv.wasm:0xdda226)
    mono_background_exec (mono-threads-wasm.c:366)
    mono_background_exec_until_done (dotnet.runtime.k71s9ljcgk.js:8001)
    callUserCallback (dotnet.native.r5qpjhb7rz.js:4718)
    (anonymous) (dotnet.native.r5qpjhb7rz.js:4738)
    setTimeout
    safeSetTimeout (dotnet.native.r5qpjhb7rz.js:4736)
    SystemJS_ScheduleBackgroundJobImpl (dotnet.runtime.k71s9ljcgk.js:8012)
    SystemJS_ScheduleBackgroundJob (mono-threads-wasm.c:333)
    $aot_wrapper_corlib_System_dot_Threading_System_dot_Threading_dot_ThreadPool__MainThreadScheduleBackgroundJob_pinvoke_void_cl7_void_2a_void_cl7_void_2a_ (dotnet.native.uetu18avbv.wasm:0xc9ee9a)
    $corlib_System_Threading_ThreadPool_EnsureWorkerRequested (dotnet.native.uetu18avbv.wasm:0xc9b26a)
    $corlib_System_Threading_ThreadPoolWorkQueue_Dispatch (dotnet.native.uetu18avbv.wasm:0xc9ce02)
    $corlib_System_Threading_ThreadPool_BackgroundJobHandler (dotnet.native.uetu18avbv.wasm:0xc9efc2)
    $corlib_wrapper_native_to_managed_System_Threading_ThreadPool_BackgroundJobHandler (dotnet.native.uetu18avbv.wasm:0xdda226)
    mono_background_exec (mono-threads-wasm.c:366)
    mono_background_exec_until_done (dotnet.runtime.k71s9ljcgk.js:8001)
    callUserCallback (dotnet.native.r5qpjhb7rz.js:4718)
    (anonymous) (dotnet.native.r5qpjhb7rz.js:4738)
    setTimeout
    safeSetTimeout (dotnet.native.r5qpjhb7rz.js:4736)
    SystemJS_ScheduleBackgroundJobImpl (dotnet.runtime.k71s9ljcgk.js:8012)
    SystemJS_ScheduleBackgroundJob (mono-threads-wasm.c:333)
    $mono_gc_finalize_notify
    sgen_client_finalize_notify (sgen-mono.c:501)
    collect_nursery (sgen-gc.c:1999)
    sgen_perform_collection_inner (sgen-gc.c:2650)
    sgen_perform_collection (sgen-gc.c:2739)
    sgen_ensure_free_space (sgen-gc.c:2616)
    sgen_alloc_obj_nolock (sgen-alloc.c:279)
    sgen_alloc_obj (sgen-alloc.c:454)
    mono_gc_alloc_obj (sgen-mono.c:690)
    $aot_wrapper_icall_mono_gc_alloc_obj (dotnet.native.uetu18avbv.wasm:0xdca9db)
    $aot_wrapper_alloc_2_AllocSmall_obj_iiii (dotnet.native.uetu18avbv.wasm:0xaeb945)
    $MudBlazor_MudBlazor_MudInputCssHelper_GetClassname_T_REF_MudBlazor_MudBaseInput_1_T_REF_System_Func_1_bool (dotnet.native.uetu18avbv.wasm:0x2303e4)
    $MudBlazor_MudBlazor_MudInput_1_T_REF_get_Classname (dotnet.native.uetu18avbv.wasm:0x224696)
    $MudBlazor_MudBlazor_MudInput_1_T_REF_BuildRenderTree_Microsoft_AspNetCore_Components_Rendering_RenderTreeBuilder (dotnet.native.uetu18avbv.wasm:0x226dd8)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_ComponentBase___ctorb__7_0_Microsoft_AspNetCore_Components_Rendering_RenderTreeBuilder (dotnet.native.uetu18avbv.wasm:0x80368)
    $Microsoft_AspNetCore_Components_wrapper_delegate_invoke__Module_invoke_void_RenderTreeBuilder_Microsoft_AspNetCore_Components_Rendering_RenderTreeBuilder (dotnet.native.uetu18avbv.wasm:0xe100a)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_Rendering_ComponentState_RenderIntoBatch_Microsoft_AspNetCore_Components_Rendering_RenderBatchBuilder_Microsoft_AspNetCore_Components_RenderFragment_System_Exception_ (dotnet.native.uetu18avbv.wasm:0xb37db)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_RenderTree_Renderer_RenderInExistingBatch_Microsoft_AspNetCore_Components_Rendering_RenderQueueEntry (dotnet.native.uetu18avbv.wasm:0xb24b7)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_RenderTree_Renderer_ProcessRenderQueue (dotnet.native.uetu18avbv.wasm:0xaf2d0)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_RenderTree_Renderer_ProcessPendingRender (dotnet.native.uetu18avbv.wasm:0xb1cf9)
    $Microsoft_AspNetCore_Components_WebAssembly_Microsoft_AspNetCore_Components_WebAssembly_Rendering_WebAssemblyRenderer_ProcessPendingRender (dotnet.native.uetu18avbv.wasm:0x142bba)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_RenderTree_Renderer_AddToRenderQueue_int_Microsoft_AspNetCore_Components_RenderFragment (dotnet.native.uetu18avbv.wasm:0x92ecb)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_RenderHandle_Render_Microsoft_AspNetCore_Components_RenderFragment (dotnet.native.uetu18avbv.wasm:0x7e40a)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_ComponentBase_StateHasChanged (dotnet.native.uetu18avbv.wasm:0x7f8b1)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_ComponentBase_Microsoft_AspNetCore_Components_IHandleEvent_HandleEventAsync_Microsoft_AspNetCore_Components_EventCallbackWorkItem_object (dotnet.native.uetu18avbv.wasm:0x801d4)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_EventCallback_1_TValue_REF_InvokeAsync_TValue_REF (dotnet.native.uetu18avbv.wasm:0x8786d)
    $MudBlazor_MudBlazor_MudFileUpload_1__ProcessFileChangeAsyncd__129_T_REF_MoveNext (dotnet.native.uetu18avbv.wasm:0x21f2c2)
    $corlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_Start_TStateMachine_GSHAREDVT_TStateMachine_GSHAREDVT_ (dotnet.native.uetu18avbv.wasm:0xda6345)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Start_TStateMachine_GSHAREDVT_TStateMachine_GSHAREDVT_ (dotnet.native.uetu18avbv.wasm:0xda64c1)
    $MudBlazor_MudBlazor_MudFileUpload_1_T_REF_ProcessFileChangeAsync_Microsoft_AspNetCore_Components_Forms_InputFileChangeEventArgs (dotnet.native.uetu18avbv.wasm:0x217ed5)
    $MudBlazor_MudBlazor_MudFileUpload_1__OnChangeAsyncd__128_T_REF_MoveNext (dotnet.native.uetu18avbv.wasm:0x21c816)
    $corlib_System_Runtime_CompilerServices_AsyncMethodBuilderCore_Start_TStateMachine_GSHAREDVT_TStateMachine_GSHAREDVT_ (dotnet.native.uetu18avbv.wasm:0xda6345)
    $corlib_System_Runtime_CompilerServices_AsyncTaskMethodBuilder_Start_TStateMachine_GSHAREDVT_TStateMachine_GSHAREDVT_ (dotnet.native.uetu18avbv.wasm:0xda64c1)
    $MudBlazor_MudBlazor_MudFileUpload_1_T_REF_OnChangeAsync_Microsoft_AspNetCore_Components_Forms_InputFileChangeEventArgs (dotnet.native.uetu18avbv.wasm:0x217dbb)
    $aot_instances_aot_wrapper_gsharedvt_out_sig_obj_this_obj (dotnet.native.uetu18avbv.wasm:0xe8b4f7)
    $aot_instances_wrapper_runtime_invoke_object_runtime_invoke_sig_void_intptr_intptr_intptr_intptr_object_intptr_intptr_intptr (dotnet.native.uetu18avbv.wasm:0x14a78aa)
    mono_llvmonly_runtime_invoke (mini-runtime.c:3431)
    mono_jit_runtime_invoke (mini-runtime.c:3695)
    do_runtime_invoke (object.c:2579)
    mono_runtime_invoke_checked (object.c:2795)
    mono_runtime_try_invoke_byrefs (object.c:5217)
    mono_handle_raw (icall.c:3667)
    ves_icall_InternalInvoke (icall.c:3584)
    ves_icall_InternalInvoke_raw (icall-def.h:367)
    $aot_wrapper_corlib_System_dot_Reflection_System_dot_Reflection_dot_RuntimeMethodInfo__InternalInvoke_pinvoke_obj_this_objcl9_intptr_2a_bclsc_Exception_26__attrs_2obj_this_objcl9_intptr_2a_bclsc_Exception_26__attrs_2 (dotnet.native.uetu18avbv.wasm:0xced644)
    $corlib_System_Reflection_MethodBaseInvoker_InterpretedInvoke_Method_object_intptr_ (dotnet.native.uetu18avbv.wasm:0xced5c3)
    $corlib_wrapper_delegate_invoke__Module_invoke_object_object_intptr__object_intptr_ (dotnet.native.uetu18avbv.wasm:0xdd35f2)
    $corlib_System_Reflection_MethodBaseInvoker_InvokeDirectByRefWithFewArgs_object_System_Span_1_object_System_Reflection_BindingFlags (dotnet.native.uetu18avbv.wasm:0xcee142)
    $corlib_System_Reflection_MethodBaseInvoker_InvokeWithOneArg_object_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (dotnet.native.uetu18avbv.wasm:0xceda96)
    $corlib_System_Reflection_RuntimeMethodInfo_Invoke_object_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (dotnet.native.uetu18avbv.wasm:0xcf549d)
    $corlib_System_Delegate_DynamicInvokeImpl_object__ (dotnet.native.uetu18avbv.wasm:0xb03048)
    $corlib_System_MulticastDelegate_DynamicInvokeImpl_object__ (dotnet.native.uetu18avbv.wasm:0xb120ba)
    $corlib_System_Delegate_DynamicInvoke_object__ (dotnet.native.uetu18avbv.wasm:0xb03cd9)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_EventCallbackWorkItem_InvokeAsync_T_REF_System_MulticastDelegate_T_REF (dotnet.native.uetu18avbv.wasm:0x85795)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_EventCallbackWorkItem_InvokeAsync_object (dotnet.native.uetu18avbv.wasm:0x80268)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_ComponentBase_Microsoft_AspNetCore_Components_IHandleEvent_HandleEventAsync_Microsoft_AspNetCore_Components_EventCallbackWorkItem_object (dotnet.native.uetu18avbv.wasm:0x8016a)
    $Microsoft_AspNetCore_Components_Microsoft_AspNetCore_Components_EventCallback_1_TValue_REF_InvokeAsync_TValue_REF (dotnet.native.uetu18avbv.wasm:0x8786d)
    $Microsoft_AspNetCore_Components_Web_Microsoft_AspNetCore_Components_Forms_InputFile_Microsoft_AspNetCore_Components_Forms_IInputFileJsCallbacks_NotifyChange_Microsoft_AspNetCore_Components_Forms_BrowserFile__ (dotnet.native.uetu18avbv.wasm:0x10e5de)
    $Microsoft_AspNetCore_Components_Web_Microsoft_AspNetCore_Components_Forms_InputFileJsCallbacksRelay_NotifyChange_Microsoft_AspNetCore_Components_Forms_BrowserFile__ (dotnet.native.uetu18avbv.wasm:0x112274)
    $aot_instances_aot_wrapper_gsharedvt_out_sig_obj_this_obj (dotnet.native.uetu18avbv.wasm:0xe8b4f7)
    $aot_instances_wrapper_runtime_invoke_object_runtime_invoke_sig_void_intptr_intptr_intptr_intptr_object_intptr_intptr_intptr (dotnet.native.uetu18avbv.wasm:0x14a78aa)
    mono_llvmonly_runtime_invoke (mini-runtime.c:3431)
    mono_jit_runtime_invoke (mini-runtime.c:3695)
    do_runtime_invoke (object.c:2579)
    mono_runtime_invoke_checked (object.c:2795)
    mono_runtime_try_invoke_byrefs (object.c:5217)
    mono_handle_raw (icall.c:3667)
    ves_icall_InternalInvoke (icall.c:3584)
    ves_icall_InternalInvoke_raw (icall-def.h:367)
    $aot_wrapper_corlib_System_dot_Reflection_System_dot_Reflection_dot_RuntimeMethodInfo__InternalInvoke_pinvoke_obj_this_objcl9_intptr_2a_bclsc_Exception_26__attrs_2obj_this_objcl9_intptr_2a_bclsc_Exception_26__attrs_2 (dotnet.native.uetu18avbv.wasm:0xced644)
    $corlib_System_Reflection_MethodBaseInvoker_InterpretedInvoke_Method_object_intptr_ (dotnet.native.uetu18avbv.wasm:0xced5c3)
    $corlib_wrapper_delegate_invoke__Module_invoke_object_object_intptr__object_intptr_ (dotnet.native.uetu18avbv.wasm:0xdd35f2)
    $corlib_System_Reflection_MethodBaseInvoker_InvokeDirectByRefWithFewArgs_object_System_Span_1_object_System_Reflection_BindingFlags (dotnet.native.uetu18avbv.wasm:0xcee142)
    $corlib_System_Reflection_MethodBaseInvoker_InvokeWithOneArg_object_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (dotnet.native.uetu18avbv.wasm:0xceda96)
    $corlib_System_Reflection_RuntimeMethodInfo_Invoke_object_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo (dotnet.native.uetu18avbv.wasm:0xcf549d)
    $corlib_System_Reflection_MethodBase_Invoke_object_object__ (dotnet.native.uetu18avbv.wasm:0xcec834)
    $Microsoft_JSInterop_Microsoft_JSInterop_Infrastructure_DotNetDispatcher_InvokeSynchronously_Microsoft_JSInterop_JSRuntime_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo__Microsoft_JSInterop_Infrastructure_IDotNetObjectReference_string (dotnet.native.uetu18avbv.wasm:0x1b9e84)
    $Microsoft_JSInterop_Microsoft_JSInterop_Infrastructure_DotNetDispatcher_BeginInvokeDotNet_Microsoft_JSInterop_JSRuntime_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo_string (dotnet.native.uetu18avbv.wasm:0x1ba3c6)
    $Microsoft_AspNetCore_Components_WebAssembly_Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime__c__BeginInvokeDotNetb__12_0_System_ValueTuple_2_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo_string (dotnet.native.uetu18avbv.wasm:0x139b74)
    $aot_instances_wrapper_delegate_invoke_System_Action_1_System_ValueTuple_2_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo_string_invoke_void_T_System_ValueTuple_2_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo_string (dotnet.native.uetu18avbv.wasm:0xfc7411)
    $aot_instances_Microsoft_AspNetCore_Components_WebAssembly_Hosting_WebAssemblyCallQueue_Schedule_System_ValueTuple_2_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo_string_System_ValueTuple_2_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo_string_System_Action_1_System_ValueTuple_2_Microsoft_JSInterop_Infrastructure_DotNetInvocationInfo_string (dotnet.native.uetu18avbv.wasm:0xfc68cb)
    $Microsoft_AspNetCore_Components_WebAssembly_Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet_string_string_string_string (dotnet.native.uetu18avbv.wasm:0x137a7e)
    $Microsoft_AspNetCore_Components_WebAssembly_Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime____Wrapper_BeginInvokeDotNet_1855805417g____Stub_23_0_System_Runtime_InteropServices_JavaScript_JSMarshalerArgument_System_Runtime_InteropServices_JavaScript_JSMarshalerArgument_System_Runtime_InteropServices_JavaScript_JSMarshalerArgument_System_Runtime_InteropServices_JavaScript_JSMarshalerArgument_System_Runtime_InteropServices_JavaScript_JSMarshalerArgument_ (dotnet.native.uetu18avbv.wasm:0x139477)
    $Microsoft_AspNetCore_Components_WebAssembly_Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime___Wrapper_BeginInvokeDotNet_1855805417_System_Runtime_InteropServices_JavaScript_JSMarshalerArgument_ (dotnet.native.uetu18avbv.wasm:0x1392cd)
    $aot_instances_aot_wrapper_gsharedvt_out_sig_void_obj (dotnet.native.uetu18avbv.wasm:0xebf54a)
    $aot_instances_wrapper_runtime_invoke_object_runtime_invoke_sig_void_intptr_intptr_object_intptr_intptr_intptr (dotnet.native.uetu18avbv.wasm:0x14a747d)
    mono_llvmonly_runtime_invoke (mini-runtime.c:3431)
    mono_jit_runtime_invoke (mini-runtime.c:3695)
    do_runtime_invoke (object.c:2579)
    mono_runtime_try_invoke (object.c:2736)
    mono_runtime_invoke (object.c:2662)
    mono_wasm_invoke_jsexport (driver.c:226)
    invoke_sync_jsexport (dotnet.runtime.k71s9ljcgk.js:5341)
    bound_fn (dotnet.runtime.k71s9ljcgk.js:6640)
    JSExport_BeginInvokeDotNet (BeginInvokeDotNet:4)
    beginInvokeDotNetFromJS (blazor.webassembly.uv9pzyktbz.js:1)
    invokeDotNetMethodAsync (blazor.webassembly.uv9pzyktbz.js:1)
    invokeMethodAsync (blazor.webassembly.uv9pzyktbz.js:1)
    (anonymous) (blazor.webassembly.uv9pzyktbz.js:1)
    
  9. pavelsavara commented on Aug 4, 2026

    @pavelsavara
    Member

    static lazy rock'n roll

    https://github.com/SixLabors/ImageSharp/blob/b81b9a2792b441788975eb4d2e54d470fdb168e2/src/ImageSharp/PixelFormats/PixelOperations%7BTPixel%7D.cs#L22-L25

    https://github.com/SixLabors/ImageSharp/blob/main/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs#L24-L26

      .method private hidebysig static specialname rtspecialname void
        .cctor() cil managed
      {
        .maxstack 8
    
        // [21 3 - 21 185]
        IL_0000: ldnull
        IL_0001: constrained. !0/*TPixel*/
        IL_0007: ldftn        class SixLabors.ImageSharp.PixelFormats.PixelOperations`1<!0/*TPixel*/> class SixLabors.ImageSharp.PixelFormats.IPixel`1<!0/*TPixel*/>::CreatePixelOperations()
        IL_000d: newobj       instance void class [System.Private.CoreLib]System.Func`1<class SixLabors.ImageSharp.PixelFormats.PixelOperations`1<!0/*TPixel*/>>::.ctor(object, native int)
        IL_0012: ldc.i4.1
        IL_0013: newobj       instance void class [System.Private.CoreLib]System.Lazy`1<class SixLabors.ImageSharp.PixelFormats.PixelOperations`1<!0/*TPixel*/>>::.ctor(class [System.Private.CoreLib]System.Func`1<!0/*class SixLabors.ImageSharp.PixelFormats.PixelOperations`1<TPixel>*/>, bool)
        IL_0018: stsfld       class [System.Private.CoreLib]System.Lazy`1<class SixLabors.ImageSharp.PixelFormats.PixelOperations`1<!0/*TPixel*/>> class SixLabors.ImageSharp.PixelFormats.PixelOperations`1<!0/*TPixel*/>::LazyInstance
        IL_001d: ret
    
      } // end of method PixelOperations`1::.cctor
    
  10. pavelsavara commented on Aug 5, 2026

    @pavelsavara
    Member

    I reduced this to a self-contained repro with no ImageSharp dependency (so no license needed). It reproduces the exact MONO_WASM: function signature mismatch trap under Mono WASM AOT.

    Minimal repro

    using System;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    
    // Reaching PixelOperations<Rgba32>.Instance through a gsharedvt-shared generic
    // method (here forced via reflection, mirroring ImageSharp's delegate-driven
    // decode path) traps under WASM AOT, because PixelOperations<TPixel>..cctor
    // builds a Lazy<> from the static-abstract method group TPixel.CreatePixelOperations.
    Console.WriteLine("REPRO: before Decode<Rgba32>");
    MethodInfo decode = typeof(PngDecoder)
        .GetMethod(nameof(PngDecoder.Decode))!
        .MakeGenericMethod(typeof(Rgba32));
    decode.Invoke(null, null);
    Console.WriteLine("REPRO: after Decode<Rgba32>");   // never reached
    
    public static class PngDecoder
    {
        public static void Decode<TPixel>()
            where TPixel : unmanaged, IPixel<TPixel>
        {
            PixelOperations<TPixel> ops = PixelOperations<TPixel>.Instance; // <- traps here (cctor)
    
            Rgba32 source = new() { R = 1, G = 2, B = 3, A = 4 };
            Span<TPixel> destination = stackalloc TPixel[1];
            for (int i = 0; i < destination.Length; i++)
            {
                destination[i] = TPixel.FromRgba32(source);
            }
            ops.FromRgba32Bytes(destination);
        }
    }
    
    public interface IPixel
    {
        static abstract int GetPixelTypeInfo();
        Rgba32 ToRgba32();
    }
    
    public interface IPackedVector<TPacked> where TPacked : struct
    {
        TPacked PackedValue { get; set; }
    }
    
    public interface IPixel<TSelf> : IPixel, IEquatable<TSelf>
        where TSelf : unmanaged, IPixel<TSelf>
    {
        static abstract PixelOperations<TSelf> CreatePixelOperations();
        static abstract TSelf FromRgba32(Rgba32 source);
    }
    
    public struct Rgba32 : IPixel<Rgba32>, IPackedVector<uint>
    {
        public byte R, G, B, A;
    
        public uint PackedValue
        {
            get => Unsafe.As<Rgba32, uint>(ref this);
            set => Unsafe.As<Rgba32, uint>(ref this) = value;
        }
    
        public static int GetPixelTypeInfo() => 32;
        public static PixelOperations<Rgba32> CreatePixelOperations() => new PixelOperations();
        public static Rgba32 FromRgba32(Rgba32 source) => source;
        public readonly Rgba32 ToRgba32() => this;
        public readonly bool Equals(Rgba32 other) => PackedValue == other.PackedValue;
    
        // Mirrors ImageSharp's nested Rgba32.PixelOperations : PixelOperations<Rgba32>.
        internal sealed class PixelOperations : PixelOperations<Rgba32>
        {
            public override void FromRgba32Bytes(Span<Rgba32> destination)
            {
                for (int i = 0; i < destination.Length; i++)
                    destination[i] = new Rgba32 { R = 8, G = 8, B = 8, A = 255 };
            }
        }
    }
    
    public class PixelOperations<TPixel>
        where TPixel : unmanaged, IPixel<TPixel>
    {
        // "static lazy rock'n roll": Lazy<> built from the static-abstract method group.
        private static readonly Lazy<PixelOperations<TPixel>> LazyInstance = new(TPixel.CreatePixelOperations, true);
        public static PixelOperations<TPixel> Instance => LazyInstance.Value;
        public virtual void FromRgba32Bytes(Span<TPixel> destination) { }
    }

    Actual output (Mono WASM AOT)

    REPRO: before Decode<Rgba32>
    MONO_WASM: function signature mismatch
    RuntimeError: function signature mismatch
        at dotnet.native.wasm:wasm-function[...]
    WASM EXIT 1
    

    REPRO: after Decode<Rgba32> is never printed — the runtime traps in PixelOperations<Rgba32>..cctor (the Lazy<> built from the static-abstract TPixel.CreatePixelOperations method group), reached through gsharedvt-shared code.

    Notes on the ingredients that matter

    • The generic entry (Decode<TPixel>) must be reached through gsharedvt-shared code — here I force that via MakeGenericMethod(...).Invoke(...); in ImageSharp it's the delegate/Func<>-driven decode path. Calling Decode<Rgba32>() directly (fully-specialized) does not trap, which is consistent with the "adding a reachable direct call fixes it" workaround in the report.
    • The Lazy<PixelOperations<TPixel>> static field initialized from the static-abstract TPixel.CreatePixelOperations method group is the trigger — this is the "static lazy" shape from ImageSharp's PixelOperations{TPixel}.

    Repro reproduces in both Release and Debug AOT

    I verified it in-tree using src/mono/sample/wasm/browser:

    # Release
    .\dotnet.cmd build /p:TargetOS=browser /p:TargetArchitecture=wasm /p:Configuration=Release /p:RuntimeFlavor=mono /t:RunSample .\src\mono\sample\wasm\browser
    

    The trap is not optimizer-dependent — it also reproduces in a Debug-config AOT build (via _WasmAllowAOTDebug=true), producing the identical function signature mismatch / WASM EXIT 1.

    Note

    This comment (and the reduced repro) was prepared with the assistance of GitHub Copilot.

  11. dotnet-policy-service commented on Aug 5, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
    See info in area-owners.md if you want to be subscribed.

  12. locked and limited conversation to collaborators on Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions