Skip to content

Delegates with generic error: The generic type 'System.Func`4' was used with an invalid instantiation in assembly  #826

Open

Description

@bnuzhouwei

I use SixLabors.ImageSharp to preprocess image, but got

System.TypeLoadException: The generic type 'System.Func`4' was used with an invalid instantiation in assembly 'System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

The code is:

    paddedHeight = int(System.Math.Ceiling(image.Height / 32.0) * 32.0)
    paddedWidth = int(System.Math.Ceiling(image.Width / 32.0) * 32.0)
    def processPixels(accessor):
        for y in range(paddedHeight-accessor.Height, accessor.Height):
            pixelSpan = accessor.GetRowSpan(y)
            for x in range(paddedWidth-accessor.Width, accessor.Width):
                pass
    delegate = SixLabors.ImageSharp.PixelAccessorAction[SixLabors.ImageSharp.PixelFormats.Rgb24](processPixels)

Activity

  1. slozier commented on Jan 9, 2023

    @slozier
    Contributor

    Not sure about this one, I assume it has to do with the accessor being a ref struct which means it probably won't work (same reason as Span, can't be boxed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions