diff options
author | Simon Nattress <simonn@microsoft.com> | 2017-04-06 02:56:57 +0300 |
---|---|---|
committer | Simon Nattress <simonn@microsoft.com> | 2017-04-06 02:56:57 +0300 |
commit | b4b7234c937aed7e1406afc99abdc4d9a2e3a907 (patch) | |
tree | 695698459ef130acddc6ab77baef4727d38842cc /tests/src/Simple/Generics/Generics.cs | |
parent | c624af43e51f6c38ad9607505d3443be17146fc0 (diff) |
Fix CoreRT generics test in Release build
The dynamic invoke tests were failing because the JIT was inlining all the target methods leaving nothing to actually invoke through reflection. Mark all the methods we invoke (including the empty constructors) with `[MethodImpl(MethodImplOptions.NoInlining)]`.
[tfs-changeset: 1653296]
Diffstat (limited to 'tests/src/Simple/Generics/Generics.cs')
-rw-r--r-- | tests/src/Simple/Generics/Generics.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/src/Simple/Generics/Generics.cs b/tests/src/Simple/Generics/Generics.cs index b1dbad6b8..2a25d2ca8 100644 --- a/tests/src/Simple/Generics/Generics.cs +++ b/tests/src/Simple/Generics/Generics.cs @@ -1357,29 +1357,38 @@ class Program public class DynamicBase<T> { public T _t; + + [MethodImpl(MethodImplOptions.NoInlining)] + public DynamicBase() {} + + [MethodImpl(MethodImplOptions.NoInlining)] public int SimpleMethod() { return 123; } + [MethodImpl(MethodImplOptions.NoInlining)] public int MethodWithTInSig(T t) { _t = t; return 234; } + [MethodImpl(MethodImplOptions.NoInlining)] public virtual string VirtualMethod(T t) { _t = t; return "DynamicBase<T>.VirtualMethod"; } + [MethodImpl(MethodImplOptions.NoInlining)] public string GenericMethod<U>(T t, U u) { _t = t; return typeof(U).ToString() + u.ToString(); } + [MethodImpl(MethodImplOptions.NoInlining)] public virtual string GenericVirtualMethod<U>(T t, U u) { _t = t; @@ -1389,12 +1398,17 @@ class Program public class DynamicDerived<T> : DynamicBase<T> { + [MethodImpl(MethodImplOptions.NoInlining)] + public DynamicDerived() {} + + [MethodImpl(MethodImplOptions.NoInlining)] public override string VirtualMethod(T t) { _t = t; return "DynamicDerived<T>.VirtualMethod"; } + [MethodImpl(MethodImplOptions.NoInlining)] public override string GenericVirtualMethod<U>(T t, U u) { _t = t; |