<div dir="ltr">Ok, so I think I misunderstood what a LinkDemand was, as well as the fact that the exception I&#39;m getting is expected behavior.<br><br>I added the [assembly: AllowPartiallyTrustedCallers] attribute to my assembly and now things work fine outside of the debug environment. From what I (now) understand, using the LinkDemand attribute is so that the partially trusted assembly (i.e. the scripts) <b>can&#39;t</b> access that method. Does that sound right to you guru types? To test this I imported System.Windows.Forms and tried to call the MessageBox.Show() method which failed while running in the domain, as expected. When I removed the LinkDemand from the ScriptableItem class the calls to it in the script also worked fine.<br>
<br>So all I have to do is decorate the classes I don&#39;t want to be imported from my assembly into the script with LinkDemands, I think? Is there some way to reverse that, I.E. some way that I can decorate the classes I want to be accessible rather than the other way around? I suppose another alternative is to create the ScriptableItem wrappers in their own assembly and just reference that, as well as make it callable by partially trusted callers, while leaving my own assembly alone and thus off-limits to an import.<br>
<br>I will play with it some more, I think. I&#39;m sorry to have wasted some of your time. =\<br><br>---<br>LC<br><br><div class="gmail_quote">On Tue, Sep 2, 2008 at 7:38 PM, Leo Carbajal <span dir="ltr">&lt;<a href="mailto:desleo@gmail.com">desleo@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">This is a condensed version. You&#39;ll have to sign the assembly or you&#39;ll get an error at the domain creation step, other than that this should run just by starting a new console application, adding the IPY and DLR DLLs, and then copying and pasting this file over the default generated code.<br>

<br>Even after starting a new project to make sure my sample builds I still observe the same behavior.<br><br>---<br><font color="#888888">LC</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Tue, Sep 2, 2008 at 6:36 PM, Curt Hagenlocher <span dir="ltr">&lt;<a href="mailto:curt@hagenlocher.org" target="_blank">curt@hagenlocher.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">Do you have a simple reproduction that doesn&#39;t include any of your domain-specific code?<br>

<br>
<div class="gmail_quote"><div><div></div><div>On Tue, Sep 2, 2008 at 4:30 PM, Leo Carbajal <span dir="ltr">&lt;<a href="mailto:desleo@gmail.com" target="_blank">desleo@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote"><div><div></div><div>
<div dir="ltr">So here&#39;s a strange wrinkle,<br><br>when I run this with the debugger (unmodified except for adding the IronPython assemblies as full-trust on the domain) it works fine and as expected. If I run it without the debugger attached it gives me the same exception as before, when I catch the exception myself I also get this tidbit:<br>


<br>The assembly or AppDomain that failed was:<br>Microsoft.Scripting, Version=1.0.0.4000, Culture=neutral, PublicKeyToken=31bf3856ad364e35<br>The Zone of the assembly that failed was:<br>MyComputer<br>The Url of the assembly that failed was:<br>


file:///B:/Code/IronPythonShell/IronPythonShell/bin/Debug/Microsoft.Scripting.DLL<br><br>If I build and compile the code as Release instead of Debug I get: <br><br>System.Runtime.Serialization.SerializationException: Type &#39;System.Scripting.SourceUnit&#39; in assembly &#39;Microsoft.Scripting.Core, Version=1.0.0.4000, Culture=neutral, PublicKeyToken=31bf3856ad364e35&#39; is not marked as serializable. 
<div><br>&nbsp;&nbsp; at Microsoft.Scripting.Hosting.ScriptRuntime.ExecuteFile(String path)<br></div>&nbsp;&nbsp; at IronPythonShell.Program.Main(String[] args) in B:\Code\IronPythonShell\IronPythonShell\Program.cs:line 54<br>
<br>It&#39;s a little beyond odd to me, but like I said before I fear I don&#39;t fully understand what&#39;s going on behind the goo. The only consolation is that I can at least built out my scripting system in working form and later run it under a more trusted domain for production by simply removing the domain from the Runtime.Create() constructor and then adding it later. (At least, I hope this is the case)<br>


<br>---<br>Leo C. 
<div><br><br>
<div class="gmail_quote">On Tue, Sep 2, 2008 at 4:50 PM, Shri Borde <span dir="ltr">&lt;<a href="mailto:Shri.Borde@microsoft.com" target="_blank">Shri.Borde@microsoft.com</a>&gt;</span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div vlink="purple" link="blue" lang="EN-US">
<div>
<p><span style="color: rgb(31, 73, 125); font-size: 11pt;">The CLR doesn&#39;t dump out full exception information on SecurityExceptions in partial trust – you can get a lot more information if you look at the exception in a debugger, or if you Assert for FullTrust before doing a ToString on the permission.&nbsp; Once you do that, you should be able to get more data including the demanded permission and the assembly which caused the demand to fail, instead of the message saying &quot;</span><span style="color: rgb(102, 102, 102);">The granted set of the failing assembly was:</span><span style="color: rgb(31, 73, 125); font-size: 11pt;">&quot; which does not say which assembly is causing the problem.</span></p>



<p><span style="color: rgb(31, 73, 125); font-size: 11pt;">&nbsp;</span></p>
<p><span style="color: rgb(31, 73, 125); font-size: 11pt;">Also, can you try adding IronPython.dll and IronPython.Modules.dll to the </span><span><span style="color: black; font-size: 8pt;">fullTrustAssemblies</span></span><span style="color: rgb(31, 73, 125); font-size: 11pt;"> argument to <a href="http://msdn.microsoft.com/en-us/library/ms130766.aspx" target="_blank">AppDomain.CreateDomain</a>?</span></p>



<p><span style="color: rgb(31, 73, 125); font-size: 11pt;">&nbsp;</span></p>
<p><span style="color: rgb(31, 73, 125); font-size: 11pt;">Thanks,</span></p>
<p><span style="color: rgb(31, 73, 125); font-size: 11pt;">Shri</span></p>
<p><span style="color: rgb(31, 73, 125); font-size: 11pt;">&nbsp;</span></p></div></div></blockquote></div><br></div></div><br></div></div><div>_______________________________________________<br>Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br><br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>