diff options
author | Joe George <joe@zeroc.com> | 2020-07-07 16:57:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-07 16:57:51 -0400 |
commit | 6c0e7e6fcabde691e7c38a814b6171f9f4e77d09 (patch) | |
tree | aed41fdff6561e134c73da214e580be0910e6f6a /csharp | |
parent | Copy python dependencies to the extension directory - Close #926 (#927) (diff) | |
download | ice-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')
-rw-r--r-- | csharp/src/Ice/PropertyNames.cs | 3 | ||||
-rw-r--r-- | csharp/test/Ice/objects/AllTests.cs | 19 | ||||
-rw-r--r-- | csharp/test/Ice/objects/InitialI.cs | 9 | ||||
-rw-r--r-- | csharp/test/Ice/objects/Test.ice | 3 |
4 files changed, 33 insertions, 1 deletions
diff --git a/csharp/src/Ice/PropertyNames.cs b/csharp/src/Ice/PropertyNames.cs index a4b0440ead6..d8926852333 100644 --- a/csharp/src/Ice/PropertyNames.cs +++ b/csharp/src/Ice/PropertyNames.cs @@ -1,7 +1,7 @@ // // Copyright (c) ZeroC, Inc. All rights reserved. // -// Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Sep 6 18:11:04 2019 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Jul 2 14:55:02 2020 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -11,6 +11,7 @@ namespace IceInternal { public static Property[] IceProps = { + new Property(@"^Ice\.AcceptClassCycles$", false, null), new Property(@"^Ice\.ACM\.Client$", true, null), new Property(@"^Ice\.ACM\.Server$", true, null), new Property(@"^Ice\.ACM\.Timeout$", false, null), 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(); |