Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bnuzhouwei opened this issue Jan 8, 2023 · 1 comment

Comments

@bnuzhouwei
Copy link

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)
@slozier
Copy link
Contributor

slozier commented Jan 9, 2023

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants