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

Suppress more managed TypeReference warnings-as-errors #80931

Merged
merged 1 commit into from
Jan 20, 2023
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
4 changes: 4 additions & 0 deletions src/mono/System.Private.CoreLib/src/System/ArgIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public TypedReference GetNextArg()
TypedReference result = default;
unsafe
{
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ('TypedReference')
IntGetNextArg(&result);
#pragma warning restore CS8500
}
return result;
}
Expand All @@ -79,7 +81,9 @@ public TypedReference GetNextArg(RuntimeTypeHandle rth)
TypedReference result = default;
unsafe
{
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ('TypedReference')
IntGetNextArgWithType(&result, rth.Value);
#pragma warning restore CS8500
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public override void SetValueDirect(TypedReference obj, object value)
unsafe
{
// Passing TypedReference by reference is easier to make correct in native code
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ('TypedReference')
RuntimeFieldHandle.SetValueDirect(this, (RuntimeType)FieldType, &obj, value, (RuntimeType?)DeclaringType);
#pragma warning restore CS8500
}
}

Expand All @@ -125,7 +127,9 @@ public override object GetValueDirect(TypedReference obj)
unsafe
{
// Passing TypedReference by reference is easier to make correct in native code
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ('TypedReference')
return RuntimeFieldHandle.GetValueDirect(this, (RuntimeType)FieldType, &obj, (RuntimeType?)DeclaringType);
#pragma warning restore CS8500
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public ref partial struct TypedReference

public static unsafe object? ToObject(TypedReference value)
{
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type ('TypedReference')
return InternalToObject(&value);
#pragma warning restore CS8500
}

[MethodImpl(MethodImplOptions.InternalCall)]
Expand Down