03-14-2013 02:01 PM
Has anyone played around with creating an additional AppDomain in a Unity Workflow Script? I have toyed around with it and cannot get the DoCallBack method to execute without error. I get the following error on the "domain.DoCallBack" line of code:
Type 'Library.Library+<>c__DisplayClass5' in assembly 'UnityScript-Id147-Ver7, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
Here's my code:
AppDomain domain = AppDomain.CreateDomain("anotherdomain", null);
CrossAppDomainDelegate action = () => {
//it doesn't matter what I put in here
};
domain.DoCallBack(action);
Why am I trying to create an additional AppDomain? Because I have resources such as assemblies and Windows.Application (WPF) references that I create during the course of the script that I want to unload/release at the end.
08-26-2013 12:45 PM
Hello Tony,
I apologize for the delay in our response to your question. At this point, my answer is probably of little use to you but might come in handy for others who are attempting the same thing.
As far as I know, creating your own AppDomains within a Unity Script is not a tested feature at all. I would say AppDomains fall outside of the defined script scope that Unity Scripts are attempting to emulate and may or may not work as expected. If you are part of an API Certified organization, the best course of action would be to contact us at API Support and troubleshoot with us through the problem.
Looking at the exception you mention and the little information there is, I would suggest you mark the DisplayClass class with the System.SerializableAttribute. My guess is .NET is attempting to serialize this DisplayClass for execution across the AppDomain boundry and cannot because it is not Serializable. I would need more information to confirm my suspicions, however.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.