Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal static int SizeOfHelper(RuntimeType t, bool throwIfNotMarshalable)
{
Debug.Assert(throwIfNotMarshalable);

if (t.IsPointer /* or IsFunctionPointer */)
if (t.IsPointer || t.IsFunctionPointer)
Copy link
Preview

Copilot AI Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing the outdated comment fragment 'or IsFunctionPointer' since the condition now explicitly includes it, which would improve clarity.

Copilot uses AI. Check for mistakes.

return IntPtr.Size;

if (t.IsByRef || t.IsArray || t.ContainsGenericParameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public void SizeOf_Object_ReturnsExpected()
Assert.NotEqual(0, Marshal.SizeOf(typeof(SomeTestStruct)));
}

[Fact]
public unsafe void SizeOf_FunctionPointer_ReturnsExpected()
{
Assert.Equal(IntPtr.Size, Marshal.SizeOf(typeof(delegate*<void>)));
}

[Fact]
public void SizeOf_Pointer_ReturnsExpected()
{
Expand Down
Loading