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

[iOS] Reenable skipped StructureToPtr tests #73236

Merged
merged 3 commits into from
Aug 5, 2022

Conversation

steveisok
Copy link
Member

As a result of #73013 landing, the skipped StructureToPtr tests can be enabled.

Contributes to #73008

As a result of dotnet#73013 landing, the skipped StructureToPtr tests can be enabled.

Contributes to dotnet#73008
@ghost
Copy link

ghost commented Aug 2, 2022

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Issue Details

As a result of #73013 landing, the skipped StructureToPtr tests can be enabled.

Contributes to #73008

Author: steveisok
Assignees: -
Labels:

area-System.Runtime.InteropServices

Milestone: -

@steveisok
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@steveisok
Copy link
Member Author

@vargaz These are still failing because it's trying to JIT:

public unsafe void PtrToStructure_GenericLayoutClass_Generic()
{
int i = 42;
IntPtr ptr = (IntPtr)(&i);
SequentialGenericClass<int> obj = new SequentialGenericClass<int>();
Marshal.PtrToStructure(ptr, obj);
Assert.Equal(i, obj.field);
}

public unsafe void PtrToStructure_GenericLayoutClass()
{
int i = 42;
IntPtr ptr = (IntPtr)(&i);
SequentialGenericClass<int> obj = new SequentialGenericClass<int>();
Marshal.PtrToStructure(ptr, (object)obj);
Assert.Equal(i, obj.field);
}

public void StructureToPtr_Flat_And_Nested_NonBlittableStructure_Success()
{
MarshalAndDestroy(new NonBlittableStruct_Flat
{
del = null,
b = 0x55,
});
MarshalAndDestroy(new NonBlittableStruct_Nested
{
s = { del = null },
b = 0x55,
});
static unsafe void MarshalAndDestroy<T>(T value) where T : struct
{
int sizeof_T = Marshal.SizeOf<T>();
void* ptr = stackalloc byte[sizeof_T];
Marshal.StructureToPtr(value, (IntPtr)ptr, false);
Marshal.DestroyStructure<T>((IntPtr)ptr);
}
}

vargaz added a commit to vargaz/runtime that referenced this pull request Aug 3, 2022
@vargaz vargaz closed this in #73301 Aug 4, 2022
vargaz added a commit that referenced this pull request Aug 4, 2022
@vargaz vargaz reopened this Aug 4, 2022
@steveisok
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@steveisok
Copy link
Member Author

@vargaz StructureToPtr_Flat_And_Nested_NonBlittableStructure_Success is still failing. I'm going to skip that test and move this PR forward.

@steveisok steveisok merged commit 591601a into dotnet:main Aug 5, 2022
@steveisok steveisok deleted the enable-interop-tests-ios branch August 5, 2022 17:21
@ghost ghost locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants