Dynamic operations can only be performed in homogenous AppDomain.

Nov 15, 2009 at 2:52 AM

I'm getting this exeption in my project, I've been following dlr for a while, so this was all a-ok until the latest ctp/beta/.net4b2 2010...

I built the dlr from source to get a bit more info, as the exception first occur's in system.core (A first chance exception of type 'System.InvalidOperationException' occurred in System.Core.dll), I also tried building the system.core included with the latest (I guess there will be a new build tomarrow) dlr, however it is missing several files (included at end of post);

After getting a PythonEngine, I'm trying to SetVariable('name", some.instance), which is where this exeption happens.

System.Core.dll!System.Runtime.CompilerServices.CallSiteBinder.BindCore<System.Func<System.Runtime.CompilerServices.CallSite,object,object,object>>(System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite,object,object,object>> site, object[] args) + 0x166 bytes 
  System.Core.dll!System.Dynamic.UpdateDelegates.UpdateAndExecute2<object,object,object>(System.Runtime.CompilerServices.CallSite site = {System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite,object,object,object>>}, object arg0 = {Microsoft.Scripting.Runtime.Scope}, object arg1 = {SO.RTL.LocalHDB}) + 0x29b bytes 
  Microsoft.Scripting.dll!Microsoft.Scripting.Runtime.DynamicOperations.SetMember(object obj, string name, object value, bool ignoreCase) Line 216 + 0x11 bytes C#
  Microsoft.Scripting.dll!Microsoft.Scripting.Hosting.ObjectOperations.SetMember(object obj, string name, object value) Line 142 + 0x15 bytes C#
  Microsoft.Scripting.dll!Microsoft.Scripting.Hosting.ScriptScope.SetVariable(string name, object value) Line 122 + 0x1a bytes C#

I tried to find any other references, but the only place I found anything was in the source code for the DLR ;).

Also, can you remove the references to System.Data, they seem unused.  Also, if possiable in the future, with your binary releases, would it make much sence to have a client profile targetted set of signed bits also?

(missing system.core files);

error CS1504: Source file 'C:\Users\files\Downloads\dlr-34591\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Ast\ExpressionWriter.cs' could not be opened ('Unspecified error ')
error CS1504: Source file 'C:\Users\files\Downloads\dlr-34591\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Actions\SmallRuleSet.cs' could not be opened ('Unspecified error ')
error CS1504: Source file 'C:\Users\files\Downloads\dlr-34591\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Ast\TreeComparer.cs' could not be opened ('Unspecified error ')
error CS1504: Source file 'C:\Users\files\Downloads\dlr-34591\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Actions\AutoRuleTemplate.cs' could not be opened ('Unspecified error ')
error CS1504: Source file 'C:\Users\files\Downloads\dlr-34591\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Compiler\ArgumentPrepender.cs' could not be opened ('Unspecified error ')
error CS1504: Source file 'C:\Users\files\Downloads\dlr-34591\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Utils\WeakUniqueSet.cs' could not be opened ('Unspecified error ')
error CS1504: Source file 'C:\Users\files\Downloads\dlr-34591\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Actions\CallSiteRule.cs' could not be opened ('Unspecified error ')

Thanks,

Shane

 

Nov 17, 2009 at 7:40 PM

This was related to an app.config option, I did not spend the time to isolate the exact one.  However it's more than likely it's one that applies only to .net 4.

Jul 2, 2010 at 3:49 PM
I'm getting the same exception running my unit tests from the continuous integration server, but I don't get any exception when I run those same tests in my dev machine. Can you please tell me what did you do to fix the problem? Thanks, Oscar
Coordinator
Jul 2, 2010 at 4:19 PM

Do you control the creation of the app domain? Does continuous integration server have any options to control it? There’s an AppDomain.CreateDomain API which is the best API to use for creating partial trust app domains. Examples are http://blogs.rev-net.com/ddewinter/2009/05/22/how-to-host-a-partial-trust-sandbox/ and http://msdn.microsoft.com/en-us/library/ms130766.aspx

The app domain does need to be homogeneous – that is all code needs to either be fully trusted or have the grant set of the app domain. The reason for this is that in a mixed app domain you could have different levels of trusted code contributing different pieces of code where one of those pieces of code is doing something bad. We didn’t have a concrete example of an exploit here but it was defense in depth and also we choose this because the CLR team recommends homogeneous app domains going forward.

From: oscarmorasu [mailto:notifications@codeplex.com]
Sent: Friday, July 02, 2010 8:50 AM
To: Dino Viehland
Subject: Re: Dynamic operations can only be performed in homogenous AppDomain. [dlr:75151]

From: oscarmorasu

I'm getting the same exception running my unit tests from the continuous integration server, but I don't get any exception when I run those same tests in my dev machine. Can you please tell me what did you do to fix the problem? Thanks, Oscar

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com