Delegates with generic error: The generic type 'System.Func`4' was used with an invalid instantiation in assembly
bnuzhouwei opened this issue · comments
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)
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).