Imported Upstream version 5.10.0.69

Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-29 19:03:06 +00:00
parent d8f8abd549
commit e2950ec768
6283 changed files with 453847 additions and 91879 deletions

View File

@@ -10,21 +10,13 @@ namespace System.Reflection.Emit
{
public sealed partial class DynamicMethod : System.Reflection.MethodInfo
{
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes, System.Reflection.Module m, bool skipVisibility) { }
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes, System.Type owner, bool skipVisibility) { }
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes) { }
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, bool restrictedSkipVisibility) { }
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Reflection.Module m) { }
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Reflection.Module m, bool skipVisibility) { }
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Type owner) { }
[System.Security.SecuritySafeCriticalAttribute]
public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Type owner, bool skipVisibility) { }
public override System.Reflection.MethodAttributes Attributes { get { throw null; } }
public override System.Reflection.CallingConventions CallingConvention { get { throw null; } }
@@ -36,15 +28,12 @@ namespace System.Reflection.Emit
public override System.Reflection.ParameterInfo ReturnParameter { get { throw null; } }
public override System.Type ReturnType { get { throw null; } }
public override System.Reflection.ICustomAttributeProvider ReturnTypeCustomAttributes { get { throw null; } }
[System.Security.SecuritySafeCriticalAttribute]
public sealed override System.Delegate CreateDelegate(System.Type delegateType) { throw null; }
[System.Security.SecuritySafeCriticalAttribute]
public sealed override System.Delegate CreateDelegate(System.Type delegateType, object target) { throw null; }
public override System.Reflection.MethodInfo GetBaseDefinition() { throw null; }
public override object[] GetCustomAttributes(bool inherit) { throw null; }
public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public System.Reflection.Emit.ILGenerator GetILGenerator() { throw null; }
[System.Security.SecuritySafeCriticalAttribute]
public System.Reflection.Emit.ILGenerator GetILGenerator(int streamSize) { throw null; }
public override System.Reflection.MethodImplAttributes GetMethodImplementationFlags() { throw null; }
public override System.Reflection.ParameterInfo[] GetParameters() { throw null; }

View File

@@ -9,6 +9,8 @@ namespace System.Reflection.Emit.Tests
{
public class DynamicMethodctor1
{
delegate ref int GetRefIntoArrayDelegate(int[] array, int index);
[Theory]
[InlineData("Method", typeof(void), null)]
[InlineData("Method", typeof(void), new Type[] { typeof(int), typeof(string) })]
@@ -113,24 +115,24 @@ namespace System.Reflection.Emit.Tests
}
[Fact]
public void ByRefReturnType_ThrowsNotSupportedException()
public void ByRefReturnType_DoesNotThrow()
{
Module module = typeof(TestClass).GetTypeInfo().Module;
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", typeof(int).MakeByRefType(), new Type[0], module));
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", typeof(int).MakeByRefType(), new Type[0], module, true));
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", typeof(int).MakeByRefType(), new Type[0], module, false));
DynamicMethod method = new DynamicMethod("Method", typeof(int).MakeByRefType(), new[] { typeof(int[]), typeof(int) });
ILGenerator generator = method.GetILGenerator();
generator.Emit(OpCodes.Ldarg_0);
generator.Emit(OpCodes.Ldarg_1);
generator.Emit(OpCodes.Ldelema, typeof(int));
generator.Emit(OpCodes.Ret);
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(int).MakeByRefType(), new Type[0], module, true));
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(int).MakeByRefType(), new Type[0], module, false));
var methodDelegate = (GetRefIntoArrayDelegate) method.CreateDelegate(typeof(GetRefIntoArrayDelegate));
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", typeof(int).MakeByRefType(), new Type[0], typeof(TestClass)));
var array = new int[] { 0, 1, 2, 3 };
ref int element = ref methodDelegate(array, 2);
element = 10;
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", typeof(int).MakeByRefType(), new Type[0], typeof(TestClass), true));
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", typeof(int).MakeByRefType(), new Type[0], typeof(TestClass), false));
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(int).MakeByRefType(), new Type[0], typeof(TestClass), true));
Assert.Throws<NotSupportedException>(() => new DynamicMethod("Method", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(int).MakeByRefType(), new Type[0], typeof(TestClass), false));
Assert.Equal(10, array[2]);
}
[Fact]

View File

@@ -4,7 +4,6 @@
<PropertyGroup>
<ProjectGuid>{C338DCF7-FB75-407B-A2ED-117FBF3AAA18}</ProjectGuid>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<ItemGroup>