diff --git a/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs b/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs index 1209465f604ce..9f65c307c12cb 100644 --- a/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs +++ b/src/mono/System.Private.CoreLib/src/System/ArgIterator.cs @@ -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; } @@ -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; } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs index 4000f316ac632..fe87104b6359a 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs @@ -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 } } @@ -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 } } diff --git a/src/mono/System.Private.CoreLib/src/System/TypedReference.Mono.cs b/src/mono/System.Private.CoreLib/src/System/TypedReference.Mono.cs index d9003bfecc6c0..4997c59e5d774 100644 --- a/src/mono/System.Private.CoreLib/src/System/TypedReference.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/TypedReference.Mono.cs @@ -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)]