blob: 3c65d0204388397dfa92c886f16fa878d533bb20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using System.Runtime.CompilerServices;
using System.Security;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.Attributes {
/// <summary>
/// The purpose of this test is mainly to provide coverage on the `KeptAttributeOnFixedBufferType` attribute
/// </summary>
[SetupCompileArgument ("/unsafe")]
// Can't verify because the test contains unsafe code
[SkipPeVerify]
public class FixedLengthArrayAttributesArePreserved {
public static void Main ()
{
Helper ();
}
[Kept]
static unsafe void Helper ()
{
var tmp = new WithFixedArrayField ();
var v = tmp.Values;
AMethodToUseTheReturnValue (v);
}
[Kept]
static unsafe void AMethodToUseTheReturnValue (int* ptr)
{
}
[Kept]
public unsafe struct WithFixedArrayField {
[Kept]
[KeptFixedBuffer]
[KeptAttributeOnFixedBufferType (typeof (UnsafeValueTypeAttribute))]
[KeptAttributeAttribute (typeof (FixedBufferAttribute))]
public fixed int Values [10];
}
}
}
|