How to Setdata to new Appdomain
<p>How to SetData to new created AppDomain. When i DoCallBack to my testFunc i receive "<strong>System.NullReferenceException</strong>" exception. What i do wrong?</p>

<pre><code>var client = "test";
var engine = 123;

AppDomain appDomain = AppDomain.CreateDomain("newDomain");

appDomain.SetData("client", client);
appDomain.SetData("engine", engine);

appDomain.DoCallBack(testFunc);

 private void testFunc()
 {
    var client = (string)AppDomain.CurrentDomain.GetData("client");
    var engine = (int)AppDomain.CurrentDomain.GetData("engine");

    Console.WriteLine("client: " + client);
    Console.WriteLine("engine: " + engine);
 }
</code></pre>

<p>Setting vars globaly for AppDomain don't change anathing, same error.</p>

<pre><code>AppDomain.CurrentDomain.SetData("client", client);
AppDomain.CurrentDomain.SetData("engine", engine);
</code></pre>

<p><strong>P.S.</strong>
I receive System.NullReferenceException, because AppDomain can't find that vars that i was setup before DoCallBack. So how to setup them in right way?</p>