diff --git a/src/Castle.Core.Tests/BasicClassProxyTestCase.cs b/src/Castle.Core.Tests/BasicClassProxyTestCase.cs index 2f5a2b2ff3..df7787f3cf 100644 --- a/src/Castle.Core.Tests/BasicClassProxyTestCase.cs +++ b/src/Castle.Core.Tests/BasicClassProxyTestCase.cs @@ -285,7 +285,6 @@ public void ProducesInvocationsThatCantChangeTarget() } [Test] - [Ignore("Multi dimensional arrays seems to not work at all")] public void ProxyTypeWithMultiDimentionalArrayAsParameters() { LogInvocationInterceptor log = new LogInvocationInterceptor(); diff --git a/src/Castle.Core.Tests/BasicInterfaceProxyTestCase.cs b/src/Castle.Core.Tests/BasicInterfaceProxyTestCase.cs index e14a83d7dc..07c0c37467 100644 --- a/src/Castle.Core.Tests/BasicInterfaceProxyTestCase.cs +++ b/src/Castle.Core.Tests/BasicInterfaceProxyTestCase.cs @@ -108,9 +108,13 @@ public void Indexer() [Test] public void ProxyTypeWithMultiDimentionalArrayAsParameter() { - generator.CreateInterfaceProxyWithTarget( + var proxy = generator.CreateInterfaceProxyWithTarget( new ClassWithMultiDimentionalArray(), new LogInvocationInterceptor()); + proxy.Do(new[] { 1, 2, 3 }); + proxy.Do2(new[,] { { 1, 2 }, { 3, 4 } }); + proxy.Do3(new[] { "a", "b", "c" }); + proxy.Do4(new[,] { { "a", "b" }, { "c", "d" } }); } [Test] diff --git a/src/Castle.Core.Tests/InterClasses/IClassWithMultiDimentionalArray.cs b/src/Castle.Core.Tests/InterClasses/IClassWithMultiDimentionalArray.cs index 8c22c94b58..d76bf2fc9d 100644 --- a/src/Castle.Core.Tests/InterClasses/IClassWithMultiDimentionalArray.cs +++ b/src/Castle.Core.Tests/InterClasses/IClassWithMultiDimentionalArray.cs @@ -18,10 +18,10 @@ public interface IClassWithMultiDimentionalArray { void Do(int[] args); - // void Do2(int[,] args); + void Do2(int[,] args); void Do3(string[] args); - // void Do4(string[,] args); + void Do4(string[,] args); } } \ No newline at end of file diff --git a/src/Castle.Core/DynamicProxy/Internal/TypeUtil.cs b/src/Castle.Core/DynamicProxy/Internal/TypeUtil.cs index f44f81d05e..0cff58c471 100644 --- a/src/Castle.Core/DynamicProxy/Internal/TypeUtil.cs +++ b/src/Castle.Core/DynamicProxy/Internal/TypeUtil.cs @@ -118,7 +118,10 @@ public static Type GetClosedParameterType(this AbstractTypeEmitter type, Type pa if (parameter.IsArray) { var elementType = GetClosedParameterType(type, parameter.GetElementType()); - return elementType.MakeArrayType(); + int rank = parameter.GetArrayRank(); + return rank == 1 + ? elementType.MakeArrayType() + : elementType.MakeArrayType(rank); } if (parameter.IsByRef)