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

[mono] Test failed on windows: System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected #34592

Open
MaximLipnin opened this issue Apr 6, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@MaximLipnin
Copy link
Contributor

System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected fails locally with the following output:

System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected(id: 2147483647, len: 2147483647, type: 32767, value: [0]) [FAIL]
System.MissingMethodException : No parameterless constructor defined for type 'System.Drawing.Imaging.PropertyItemInternal'.
Stack Trace:
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1954,0): at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1925,0): at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1803,0): at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs(95,0): at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs(87,0): at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.cs(41,0): at System.Activator.CreateInstance(Type type)
    _\src\mono\netcore\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Mono.cs(319,0): at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr ptr, Type structureType)
    _\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs(563,0): at System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr ptr, Type structureType)
    _\src\libraries\System.Drawing.Common\src\System\Drawing\PropertyItemInternal.cs(74,0): at System.Drawing.Imaging.PropertyItemInternal.ConvertFromMemory(IntPtr propdata, Int32 count)
    _\src\libraries\System.Drawing.Common\src\System\Drawing\Image.Windows.cs(468,0): at System.Drawing.Image.get_PropertyItems()
    _\src\libraries\System.Drawing.Common\tests\Imaging\PropertyItemTests.cs(51,0): at System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected(Int32 id, Int32 len, Int16 type, Byte[] value)
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected(id: -2147483648, len: -2147483648, type: -32768, value: [1, 1]) [FAIL]
System.MissingMethodException : No parameterless constructor defined for type 'System.Drawing.Imaging.PropertyItemInternal'.
Stack Trace:
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1954,0): at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1925,0): at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1803,0): at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs(95,0): at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs(87,0): at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.cs(41,0): at System.Activator.CreateInstance(Type type)
    _\src\mono\netcore\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Mono.cs(319,0): at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr ptr, Type structureType)
    _\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs(563,0): at System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr ptr, Type structureType)
    _\src\libraries\System.Drawing.Common\src\System\Drawing\PropertyItemInternal.cs(74,0): at System.Drawing.Imaging.PropertyItemInternal.ConvertFromMemory(IntPtr propdata, Int32 count)
    _\src\libraries\System.Drawing.Common\src\System\Drawing\Image.Windows.cs(468,0): at System.Drawing.Image.get_PropertyItems()
    _\src\libraries\System.Drawing.Common\tests\Imaging\PropertyItemTests.cs(51,0): at System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected(Int32 id, Int32 len, Int16 type, Byte[] value)
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected(id: 0, len: 0, type: 0, value: []) [FAIL]
System.MissingMethodException : No parameterless constructor defined for type 'System.Drawing.Imaging.PropertyItemInternal'.
Stack Trace:
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1954,0): at System.RuntimeType.CreateInstanceMono(Boolean nonPublic, Boolean wrapExceptions)
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1925,0): at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean skipCheckThis, Boolean fillCache)
    _\src\mono\netcore\System.Private.CoreLib\src\System\RuntimeType.Mono.cs(1803,0): at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs(95,0): at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs(87,0): at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.cs(41,0): at System.Activator.CreateInstance(Type type)
    _\src\mono\netcore\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Mono.cs(319,0): at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr ptr, Type structureType)
    _\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs(563,0): at System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr ptr, Type structureType)
    _\src\libraries\System.Drawing.Common\src\System\Drawing\PropertyItemInternal.cs(74,0): at System.Drawing.Imaging.PropertyItemInternal.ConvertFromMemory(IntPtr propdata, Int32 count)
    _\src\libraries\System.Drawing.Common\src\System\Drawing\Image.Windows.cs(468,0): at System.Drawing.Image.get_PropertyItems()
    _\src\libraries\System.Drawing.Common\tests\Imaging\PropertyItemTests.cs(51,0): at System.Drawing.Imaging.Tests.PropertyItemTests.Properties_SetValues_ReturnsExpected(Int32 id, Int32 len, Int16 type, Byte[] value)
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

This test will be marked with ActiveIssue in #32592.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Drawing untriaged New issue has not been triaged by the area owner labels Apr 6, 2020
@ghost
Copy link

ghost commented Apr 6, 2020

Tagging @safern as an area owner

@safern safern added the runtime-mono specific to the Mono runtime label Apr 6, 2020
@ericstj
Copy link
Member

ericstj commented Apr 10, 2020

Interesting, looks like a bug in Mono's PtrToStructure

propcopy = (PropertyItemInternal)Marshal.PtrToStructure(propdata,
typeof(PropertyItemInternal))!;

This should work since the calling code has access to the constructor

However Mono's implementation attempts to call a public constructor:

    _\src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs(87,0): at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    _\src\libraries\System.Private.CoreLib\src\System\Activator.cs(41,0): at System.Activator.CreateInstance(Type type)
    _\src\mono\netcore\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Mono.cs(319,0): at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr ptr, Type structureType) 

@tannergooding tannergooding removed the untriaged New issue has not been triaged by the area owner label Jul 8, 2020
@tannergooding tannergooding added this to the Future milestone Jul 8, 2020
@hughbe
Copy link
Contributor

hughbe commented Jan 13, 2021

We may be able to fix this by converting PropertyItemInternal into a struct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants