Skip to content

BeginInvoke - PlatformNotSupportedException on NET 5 #6

@BrianBergh

Description

@BrianBergh

Hi.
Im using MonoGame.Extended2 in my Memory3D Engine.

I reacently ported the original .NET Framework codebase to .NET 5 (Monogame 3.8 Core)

This gives an error when the video reaches the end, as of this line
(apx line 540)
Ended?.BeginInvoke(this, EventArgs.Empty, null, null);
in MonoGame.Extended.VideoPlayback\DecodeContext.cs

is not suppored in NET 5.

I have found a workaround my self, and it seems to do the trick (everything works perfect in NET 5 now)
Use Task.Run instead, works like a charm!

        // Must use BeginInvoke. See the explanations of Ended.
        // Ended?.BeginInvoke(this, EventArgs.Empty, null, null);
        Task.Run(() => // .NET 5 compatible as BeginInvoke is not supported
        {
          Ended?.Invoke(this, EventArgs.Empty);
        });

However, i have no clue on how to contribute to this repo :(
If i could, i would do it.

Anyway, there is the solution - fully tested in NET 5, works perfect :P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions