edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/sys.cs;C468100
File: sys.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/sys.cs;C468100  (server)    6/24/2008 12:45 PM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/sys.cs;Partial2
@@ -24,6 +24,7 @@
 using IronPython.Runtime.Calls;
 using IronPython.Runtime.Exceptions;
 using IronPython.Runtime.Operations;
+using System.Security;
 
 [assembly: PythonModule("sys", typeof(IronPython.Runtime.SysModule))]
 namespace IronPython.Runtime {
@@ -34,6 +35,18 @@
         // builtin_module_names is set by PythonContext and updated on reload
         public const string copyright = "Copyright (c) Microsoft Corporation. All rights reserved.";
 
+        static SysModule() {
+#if SILVERLIGHT
+            prefix = String.Empty;
+#else
+            try {
+                prefix = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+            } catch (SecurityException) {
+                prefix = String.Empty;
+            }
+#endif
+        }
+
         public static void displayhook(object value) {
             throw PythonOps.NotImplementedError("IronPython does not support sys.displayhook");
         }
@@ -112,13 +125,7 @@
         public const string platform = "cli";
 #endif
 
-        // default to location of IronPython.dll, host can override by calling ScriptEngine.InitializeModules
-        // In Silverlight the 1 host always sets this
-#if SILVERLIGHT
-        public const string prefix = "";
-#else
-        public static readonly string prefix = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
-#endif
+        public static readonly string prefix;
 
         // ps1 and ps2 are set by PythonContext and only on the initial load
 
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Driver.cs;C474221
File: Driver.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Driver.cs;C474221  (server)    6/24/2008 11:19 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Driver.cs;Partial2
@@ -152,11 +152,13 @@
         public static void Main(string[]/*!*/ arguments) {
             List<string> args = new List<string>(arguments);
             if (args.Contains("/partial")) {
+                Console.WriteLine("Running in partial trust");
+
                 PermissionSet ps = CreatePermissionSetByName();
                 AppDomainSetup setup = new AppDomainSetup();
                 setup.ApplicationBase = Environment.CurrentDirectory;
-                AppDomain domain = AppDomain.CreateDomain("Tests", null, setup, ps); 
-                
+                AppDomain domain = AppDomain.CreateDomain("Tests", null, setup, ps);
+
                 Loader loader = new Loader(args);
                 domain.DoCallBack(new CrossAppDomainDelegate(loader.Run));
                 
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;C472854
File: RubyExecutionContext.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;C472854  (server)    6/24/2008 10:37 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;Partial2
@@ -335,15 +335,19 @@
             DefineGlobalVariableNoLock(SymbolTable.StringToId("SAFE"), Runtime.GlobalVariables.SafeLevel);
 
             try {
-                Process process = Process.GetCurrentProcess();
-                DefineGlobalVariableNoLock(Symbols.CurrentProcessId, new ReadOnlyGlobalVariableInfo(process.Id));
-                DefineGlobalVariableNoLock(Symbols.CurrentProcessId, new ReadOnlyGlobalVariableInfo(process.Id));
+                TrySetCurrentProcessVariables();
             } catch (SecurityException) {
                 // nop
             }
 #endif
         }
 
+        private void TrySetCurrentProcessVariables() {
+            Process process = Process.GetCurrentProcess();
+            DefineGlobalVariableNoLock(Symbols.CurrentProcessId, new ReadOnlyGlobalVariableInfo(process.Id));
+            DefineGlobalVariableNoLock(Symbols.CurrentProcessId, new ReadOnlyGlobalVariableInfo(process.Id));
+        }
+
         private void InitializeGlobalConstants() {
             Debug.Assert(_objectClass != null);
 
===================================================================
edit: $/Dev10/feature/vs_langs01/ndp/fx/src/Core/Microsoft/Scripting/Compiler/CompilerDebugOptions.cs;C473102
File: CompilerDebugOptions.cs
===================================================================
--- $/Dev10/feature/vs_langs01/ndp/fx/src/Core/Microsoft/Scripting/Compiler/CompilerDebugOptions.cs;C473102  (server)    6/24/2008 11:11 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/ndp/fx/src/Core/Microsoft/Scripting/Compiler/CompilerDebugOptions.cs;Partial2
@@ -13,6 +13,7 @@
  *
  * ***************************************************************************/
 
+using System.Security;
 namespace System.Scripting.Expressions {
 
     /// <summary>
@@ -46,10 +47,17 @@
             _showIL = false;
             _dumpIL = false;
 #else
-            string opts = Environment.GetEnvironmentVariable("lambdacompiler_debug");
+            string opts;
+            try {
+                opts = Environment.GetEnvironmentVariable("lambdacompiler_debug");
+            } catch (SecurityException) {
+                return;
+            }
+
             if (opts == null) {
                 return;
             }
+
             foreach (string opt in opts.Split(' ', ';', ',')) {
                 switch (opt.ToLower(System.Globalization.CultureInfo.InvariantCulture)) {
                     case "showtrees":
===================================================================
