summaryrefslogtreecommitdiff
path: root/csharp/test
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2020-07-07 16:57:51 -0400
committerGitHub <noreply@github.com>2020-07-07 16:57:51 -0400
commit6c0e7e6fcabde691e7c38a814b6171f9f4e77d09 (patch)
treeaed41fdff6561e134c73da214e580be0910e6f6a /csharp/test
parentCopy python dependencies to the extension directory - Close #926 (#927) (diff)
downloadice-6c0e7e6fcabde691e7c38a814b6171f9f4e77d09.tar.bz2
ice-6c0e7e6fcabde691e7c38a814b6171f9f4e77d09.tar.xz
ice-6c0e7e6fcabde691e7c38a814b6171f9f4e77d09.zip
Add class cycle detection during unmarshaling (#946)
Add support for detection of class cycles during unmarshaling in languages which do no have garbage collection: C++, Swift, and Objective-C. A `MarshalException` is thrown when a cycle is detected. The property `Ice.AcceptClassCycles` can be set to a value greater than `0` to change this behavior.
Diffstat (limited to 'csharp/test')
-rw-r--r--csharp/test/Ice/objects/AllTests.cs19
-rw-r--r--csharp/test/Ice/objects/InitialI.cs9
-rw-r--r--csharp/test/Ice/objects/Test.ice3
3 files changed, 31 insertions, 0 deletions
diff --git a/csharp/test/Ice/objects/AllTests.cs b/csharp/test/Ice/objects/AllTests.cs
index d0cfb08c6ba..abfa3785dc0 100644
--- a/csharp/test/Ice/objects/AllTests.cs
+++ b/csharp/test/Ice/objects/AllTests.cs
@@ -538,6 +538,25 @@ namespace Ice
}
output.WriteLine("ok");
+ output.Write("testing sending class cycle... ");
+ output.Flush();
+ {
+ var rec = new Test.Recursive();
+ rec.v = rec;
+ var acceptsCycles = initial.acceptsClassCycles();
+ try
+ {
+ initial.setCycle(rec);
+ test(acceptsCycles);
+ }
+ catch(Ice.UnknownLocalException)
+ {
+ test(!acceptsCycles);
+ }
+
+ }
+ output.WriteLine("ok");
+
return initial;
}
}
diff --git a/csharp/test/Ice/objects/InitialI.cs b/csharp/test/Ice/objects/InitialI.cs
index 19e34a228d8..0aa1a0451f6 100644
--- a/csharp/test/Ice/objects/InitialI.cs
+++ b/csharp/test/Ice/objects/InitialI.cs
@@ -123,6 +123,15 @@ namespace Ice
return true;
}
+ public override void setCycle(Test.Recursive r, Ice.Current current)
+ {
+ }
+
+ public override bool acceptsClassCycles(Ice.Current current)
+ {
+ return true;
+ }
+
public override Test.D1 getD1(Test.D1 d1, Ice.Current current)
{
return d1;
diff --git a/csharp/test/Ice/objects/Test.ice b/csharp/test/Ice/objects/Test.ice
index 9fda575741c..9bcea5b2eaa 100644
--- a/csharp/test/Ice/objects/Test.ice
+++ b/csharp/test/Ice/objects/Test.ice
@@ -216,6 +216,9 @@ interface Initial
void setRecursive(Recursive p);
bool supportsClassGraphDepthMax();
+ void setCycle(Recursive r);
+ bool acceptsClassCycles();
+
["marshaled-result"] B getMB();
["amd", "marshaled-result"] B getAMDMB();