Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Castle.Core.Tests/BasicClassProxyTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 5 additions & 1 deletion src/Castle.Core.Tests/BasicInterfaceProxyTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ public void Indexer()
[Test]
public void ProxyTypeWithMultiDimentionalArrayAsParameter()
{
generator.CreateInterfaceProxyWithTarget<IClassWithMultiDimentionalArray>(
var proxy = generator.CreateInterfaceProxyWithTarget<IClassWithMultiDimentionalArray>(
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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
5 changes: 4 additions & 1 deletion src/Castle.Core/DynamicProxy/Internal/TypeUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down