-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Implement RuntimeHelpers.SizeOf #100618
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
Implement RuntimeHelpers.SizeOf #100618
Changes from 4 commits
3362c4a
47c6a24
16ea830
cb7ec92
47d3b54
c086418
84b4c0f
49e6521
f93baee
6898911
3423a52
1c473f6
21fde4e
51a93b2
ec81d77
ed05d1a
7908cf6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,5 +211,19 @@ private static extern unsafe IntPtr GetSpanDataFrom( | |
|
||
[MethodImplAttribute(MethodImplOptions.InternalCall)] | ||
private static extern bool SufficientExecutionStack(); | ||
|
||
[MethodImplAttribute(MethodImplOptions.InternalCall)] | ||
private static extern int SizeOf(QCallTypeHandle handle); | ||
|
||
public static int SizeOf(RuntimeTypeHandle type) | ||
{ | ||
if (type.Value == IntPtr.Zero) | ||
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.type); | ||
|
||
if (Type.GetTypeFromHandle(type)!.IsGenericParameter) | ||
throw new ArgumentException(SR.Arg_TypeNotSupported); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a limitation of mono runtime (which doesn't exist in coreclr)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this is the same limitation in CoreCLR and NativeAOT (though the implementations are slightly different due to how the different type systems are implemented). |
||
|
||
return SizeOf(new QCallTypeHandle(ref type)); | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.