ImageLoadException when running unit test with NUnit.Engine NuGet package

If I reference the most recent version (currently 3.20.0) of NUnit.Engine I cannot run NUnit tests that use Aspose.Imaging. If I stop referencing NUnit.Engine, things work. Can you point me to a solution?

I have attached the code: AsposeImagingBug.zip (1.0 KB)

If I run dotnet test I get this error:

Test (160ms): Error Message: Aspose.Imaging.CoreExceptions.ImageLoadException : Image loading failed.
----> System.TypeInitializationException : The type initializer for ‘Aspose.Imaging.ImageLoadersRegistry’ threw
an exception.
----> Aspose.Imaging.CoreExceptions.ImageLoadException : Error invocation Aspose.Imaging.InjectAsposeDrawing.Pro
cess
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.TypeInitializationException : The type initializer for ‘#=zCiVvUexzmp2vr3eCl0xk0WwsEp96F8gt$WhG$NJD
us3f’ threw an exception.
----> System.InvalidOperationException : Operation is not valid due to the current state of the object.
Stack Trace:
at Aspose.Imaging.Image.#=zxUuv1H0zcDK_(StreamContainer #=zDHiQAB6AWTjK, LoadOptions #=zxqtF1wLRz7_d, #=zpwpOK2
4sHifcjIGWBCIrGX6xviOzXFcSigiuo_8= #=zbIouLs4=)
at Aspose.Imaging.Image.Load(String filePath)
at AsposeImagingBug.Tests.Test() in C:\Downloads\AsposeImagingBug\Tests.cs:line 11
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructo
r)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
–TypeInitializationException
at Aspose.Imaging.ImageLoadersRegistry.#=zH8Tgzro$g5_P(Stream #=z9xQVHL4=, LoadOptions #=zxqtF1wLRz7_d, Boolean
#=zbHbZWSPCfowX)
at Aspose.Imaging.Image.#=zxUuv1H0zcDK_(StreamContainer #=zDHiQAB6AWTjK, LoadOptions #=zxqtF1wLRz7_d, #=zpwpOK2
4sHifcjIGWBCIrGX6xviOzXFcSigiuo_8= #=zbIouLs4=)
–ImageLoadException
at #=zkT8nPKuRKyHg3M8OccagRh87Kkvx.#=zGrKR6Ew=(#=zkGVzfUYaIk1_5RiYjnONQIS2Vvc6 #=zUUu4crk=)
at Aspose.Imaging.ImageLoadersRegistry…cctor()
–TargetInvocationException
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] para
meters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object
[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
at #=zkT8nPKuRKyHg3M8OccagRh87Kkvx.#=zGrKR6Ew=(#=zkGVzfUYaIk1_5RiYjnONQIS2Vvc6 #=zUUu4crk=)
–TypeInitializationException
at #=zCiVvUexzmp2vr3eCl0xk0WwsEp96F8gt$WhG$NJDus3f.#=z_aWkZTTDDiXLm1DB4Q==(Boolean #=zCjXomUU=)
at Aspose.Imaging.InjectAsposeDrawing.Process()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructo
r)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
–InvalidOperationException
at #=zCiVvUexzmp2vr3eCl0xk0WwsEp96F8gt$WhG$NJDus3f…cctor()

@jic I will check your project and try to answer as soon as possible.

@jic
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): IMAGINGNET-7661

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.