Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2003-08-15 17:59:41 +0400
committerZoltan Varga <vargaz@gmail.com>2003-08-15 17:59:41 +0400
commit611ee1f539a4ee325d2108b825f5772058271128 (patch)
tree70bc1b24a7d5980188caffe753ec2981ba436023
parent120a246e00f777f3d75ba59d5b2dddb15f5477db (diff)
2003-08-15 Zoltan Varga <vargaz@freemail.hu>
* mono/tests/bug-47295.cs: Regression test for bug #47295. svn path=/trunk/mono/; revision=17358
-rw-r--r--ChangeLog4
-rw-r--r--mono/tests/Makefile.am5
-rwxr-xr-xmono/tests/bug-47295.cs85
3 files changed, 92 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d5040dff93..6cb6de072c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-08-15 Zoltan Varga <vargaz@freemail.hu>
+
+ * mono/tests/bug-47295.cs: Regression test for bug #47295.
+
2003-08-11 Duncan Mak <duncan@ximian.com>
* runtime/Makefile.am (assemblies_DATA): Add Mono.Cairo.dll.
diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am
index 61d4c449a59..4341d28c0b3 100644
--- a/mono/tests/Makefile.am
+++ b/mono/tests/Makefile.am
@@ -168,7 +168,8 @@ TEST_CS_SRC= \
threadpool.cs \
threadpool1.cs \
base-definition.cs \
- bug-27420.cs
+ bug-27420.cs \
+ bug-47295.cs
# These only compile with MS CSC
TEST_CSC_SRC= \
@@ -253,7 +254,7 @@ testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la
echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
if [ $$failed > 0 ]; then echo -e "\nFailed tests:\n"; for i in $${failed_tests}; do echo $${i}; done; fi;
-testinterp: $(TESTSI_CS) $(TESTSI_IL) libtest.la
+testinterp: $(TESTSI_CS) libtest.la
@failed=0; \
passed=0; \
failed_tests="";\
diff --git a/mono/tests/bug-47295.cs b/mono/tests/bug-47295.cs
new file mode 100755
index 00000000000..4bb18ac0a30
--- /dev/null
+++ b/mono/tests/bug-47295.cs
@@ -0,0 +1,85 @@
+//
+// bug-47295.cs:
+//
+// Regression test for bug #47295.
+//
+// Test from Marcus Urban (mathpup@mylinuxisp.com)
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+
+
+public class Testing
+{
+ public static void Method(int value)
+ {
+ Console.WriteLine( "Method( {0} )", value );
+ }
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct DelegateList
+ {
+ internal Delegate del;
+ }
+
+
+ public static void Main()
+ {
+ // Create a dynamic assembly and module to contain the
+ // subclass of MulticastDelegate that we will create
+
+ AssemblyName asmName = new AssemblyName();
+ asmName.Name = "DynamicAssembly";
+
+ AssemblyBuilder asmBuilder =
+ AppDomain.CurrentDomain.DefineDynamicAssembly(
+ asmName, AssemblyBuilderAccess.Run );
+
+ ModuleBuilder modBuilder = asmBuilder.DefineDynamicModule
+( "DynamicModule" );
+
+ TypeBuilder typeBuilder = modBuilder.DefineType( "MyType",
+ TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.Sealed,
+ typeof( System.MulticastDelegate ) );
+
+ ConstructorBuilder cb = typeBuilder.DefineConstructor(
+ MethodAttributes.Public | MethodAttributes.HideBySig |
+ MethodAttributes.RTSpecialName | MethodAttributes.SpecialName,
+ CallingConventions.Standard,
+ new Type[] { typeof(Object), typeof (IntPtr) } );
+
+ cb.SetImplementationFlags( MethodImplAttributes.Runtime |
+MethodImplAttributes.Managed );
+
+ MethodBuilder mb = typeBuilder.DefineMethod(
+ "Invoke",
+ MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.
+HideBySig,
+ typeof(void),
+ new Type[] { typeof(int) } );
+
+ mb.SetImplementationFlags( MethodImplAttributes.Runtime |
+MethodImplAttributes.Managed );
+ ParameterBuilder pb = mb.DefineParameter (1, ParameterAttributes.HasFieldMarshal, "foo");
+ pb.SetMarshal (UnmanagedMarshal.DefineUnmanagedMarshal (UnmanagedType.I2));
+
+ // Create an instance of the delegate type and invoke it -- just to test
+
+ Type myDelegateType = typeBuilder.CreateType();
+ Delegate d = Delegate.CreateDelegate( myDelegateType, typeof
+( Testing ), "Method" );
+ d.DynamicInvoke( new object[] { 8 } );
+
+ DelegateList delegateList = new DelegateList();
+ delegateList.del = d;
+ IntPtr ptr = Marshal.AllocHGlobal( Marshal.SizeOf( delegateList ) );
+
+ // The execption seems to occur at this statement:
+ Marshal.StructureToPtr( delegateList, ptr, false );
+ }
+
+}