diff --git a/src/libraries/System.Runtime/tests/System/ActivatorTests.cs b/src/libraries/System.Runtime/tests/System/ActivatorTests.cs index 0533cfaebdd4f..e4338ebdc45ab 100644 --- a/src/libraries/System.Runtime/tests/System/ActivatorTests.cs +++ b/src/libraries/System.Runtime/tests/System/ActivatorTests.cs @@ -36,6 +36,9 @@ public static void CreateInstance() Assert.Equal(4, c.I); Activator.CreateInstance(typeof(StructTypeWithoutReflectionMetadata)); + + StructWithPublicDefaultConstructor s = (StructWithPublicDefaultConstructor)Activator.CreateInstance(typeof(StructWithPublicDefaultConstructor)); + Assert.True(s.ConstructorInvoked); } [Fact] diff --git a/src/tests/reflection/ActivateStructDefCtor/ActivateStructDefCtor.il b/src/tests/reflection/ActivateStructDefCtor/ActivateStructDefCtor.il deleted file mode 100644 index e80c0357271f6..0000000000000 --- a/src/tests/reflection/ActivateStructDefCtor/ActivateStructDefCtor.il +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - - -.assembly extern System.Runtime { auto } -.assembly extern mscorlib { auto } - - -.assembly ActivateStructDefCtor -{ -} - -// =============== CLASS MEMBERS DECLARATION =================== - -.class private abstract auto ansi sealed beforefieldinit Program - extends [System.Runtime]System.Object -{ - .class sequential ansi sealed nested private beforefieldinit Foo - extends [System.Runtime]System.ValueType - { - .field public int32 x - - .method public hidebysig specialname rtspecialname - instance void .ctor() cil managed - { - // Code size 8 (0x8) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldc.i4.1 - IL_0002: stfld int32 Program/Foo::x - IL_0007: ret - } // end of method Foo::.ctor - } // end of class Foo - - .field private static int32 Pass - .field private static int32 Fail - - .method public hidebysig static int32 Main() cil managed - { - .entrypoint - // Code size 89 (0x59) - .maxstack 2 - .locals init ([0] int32 testIndex, - [1] int32 i, - [2] valuetype Program/Foo foo) - IL_0000: ldc.i4.m1 - IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: stloc.1 - IL_0004: br.s IL_004f - - IL_0006: ldloc.0 - IL_0007: ldc.i4.1 - IL_0008: add - IL_0009: stloc.0 - IL_000a: call !!0 [System.Runtime]System.Activator::CreateInstance() - IL_000f: stloc.2 - IL_0010: ldloc.2 - IL_0011: ldfld int32 Program/Foo::x - IL_0016: ldc.i4.1 - IL_0017: beq.s IL_0021 - - IL_0019: ldsfld int32 Program::Fail - IL_001e: ldloc.0 - IL_001f: add - IL_0020: ret - - IL_0021: ldloc.0 - IL_0022: ldc.i4.1 - IL_0023: add - IL_0024: stloc.0 - IL_0025: ldtoken Program/Foo - IL_002a: call class [System.Runtime]System.Type [System.Runtime]System.Type::GetTypeFromHandle(valuetype [System.Runtime]System.RuntimeTypeHandle) - IL_002f: call object [System.Runtime]System.Activator::CreateInstance(class [System.Runtime]System.Type) - IL_0034: unbox.any Program/Foo - IL_0039: stloc.2 - IL_003a: ldloc.2 - IL_003b: ldfld int32 Program/Foo::x - IL_0040: ldc.i4.1 - IL_0041: beq.s IL_004b - - IL_0043: ldsfld int32 Program::Fail - IL_0048: ldloc.0 - IL_0049: add - IL_004a: ret - - IL_004b: ldloc.1 - IL_004c: ldc.i4.1 - IL_004d: add - IL_004e: stloc.1 - IL_004f: ldloc.1 - IL_0050: ldc.i4.2 - IL_0051: blt.s IL_0006 - - IL_0053: ldsfld int32 Program::Pass - IL_0058: ret - } // end of method Program::Main - - .method private hidebysig specialname rtspecialname static - void .cctor() cil managed - { - // Code size 15 (0xf) - .maxstack 8 - IL_0000: ldc.i4.s 100 - IL_0002: stsfld int32 Program::Pass - IL_0007: ldc.i4.s 101 - IL_0009: stsfld int32 Program::Fail - IL_000e: ret - } // end of method Program::.cctor -} // end of class Program diff --git a/src/tests/reflection/ActivateStructDefCtor/ActivateStructDefCtor.ilproj b/src/tests/reflection/ActivateStructDefCtor/ActivateStructDefCtor.ilproj deleted file mode 100644 index 102de7ba37477..0000000000000 --- a/src/tests/reflection/ActivateStructDefCtor/ActivateStructDefCtor.ilproj +++ /dev/null @@ -1,8 +0,0 @@ - - - Library - - - - - diff --git a/src/tests/reflection/regression/dev10bugs/Dev10_629953.csproj b/src/tests/reflection/regression/dev10bugs/Dev10_629953.csproj deleted file mode 100644 index 6fad4fc3ebb0d..0000000000000 --- a/src/tests/reflection/regression/dev10bugs/Dev10_629953.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - Exe - true - BuildAndRun - 1 - - - - - diff --git a/src/tests/reflection/regression/dev10bugs/dev10_629953.cs b/src/tests/reflection/regression/dev10bugs/dev10_629953.cs deleted file mode 100644 index 9a7706727cc90..0000000000000 --- a/src/tests/reflection/regression/dev10bugs/dev10_629953.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// Regression case for: -// CoreCLR => Dev10 #629953 - SL4: User Breaking Change: Enum.IsDefined no longer throws an ArgumentException in invalid cases -// Desktop => Dev10 #766944 - Breaking change follow up: Enum.IsDefined no longer throws an ArgumentException in invalid cases (This bug should be fixed, if 629953 is fixed for Silverlight) - -using System; - -public enum EnumInt32 : int -{ - One, Two, Three -} - -public class Test -{ - public static bool Negative() - { - Console.WriteLine(); - Console.WriteLine("Negative case - Enum type is Int32, value type is byte"); - - try - { - bool b = Enum.IsDefined(typeof(EnumInt32), (byte)1); - Console.WriteLine("FAIL> Expect to see an ArgumentException: returned ({0})!", b); - return false; - } - catch (ArgumentException) - { - Console.WriteLine("PASS> Expected ArgumentException is thrown."); - return true; - } - } - - public static bool Positive() - { - Console.WriteLine(); - Console.WriteLine("Positive case - Enum type is Int32, value type is Int32"); - - try - { - bool b = Enum.IsDefined(typeof(EnumInt32), (int)1); - Console.WriteLine("PASS> No exception: returned ({0}).", b); - return true; - } - catch (Exception e) - { - Console.WriteLine("FAIL> Unexpected exception is thrown."); - Console.WriteLine(e); - return false; - } - } - - public static int Main() - { - bool retVal = true; - - retVal &= Negative(); - retVal &= Positive(); - - if (retVal) - { - Console.WriteLine(); - Console.WriteLine("TEST PASSED."); - return 100; - } - else - { - Console.WriteLine(); - Console.WriteLine("TEST FAILED!"); - return 110; - } - } -} diff --git a/src/tests/reflection/regression/reflectionrepromasterforsl/Helper.csproj b/src/tests/reflection/regression/reflectionrepromasterforsl/Helper.csproj deleted file mode 100644 index 0ce05ae2f7d5f..0000000000000 --- a/src/tests/reflection/regression/reflectionrepromasterforsl/Helper.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - Library - true - SharedLibrary - 1 - - - - - diff --git a/src/tests/reflection/regression/reflectionrepromasterforsl/helper.cs b/src/tests/reflection/regression/reflectionrepromasterforsl/helper.cs deleted file mode 100644 index ea2bd09c71ad3..0000000000000 --- a/src/tests/reflection/regression/reflectionrepromasterforsl/helper.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Security; - -public class Helper -{ - [SecurityCritical] - public Helper(string s) - { - Console.WriteLine("FAIL: Public Helper..ctor(string) is called!"); - } - - [SecurityCritical] - internal Helper() - { - Console.WriteLine("FAIL: Internal Helper..ctor() is called!"); - } - - [SecurityCritical] - public static void PublicSecurityCriticalMethod() - { - Console.WriteLine("FAIL: Helper.PublicSecurityCriticalMethod is called!"); - } - - [SecurityCritical] - internal static void InternalSecurityCriticalMethod() - { - Console.WriteLine("FAIL: Helper.InternalSecurityCriticalMethod is called!"); - } -}