public PythonObject(IronPythonInterpreter interpreter, ObjectIdentityHandle obj) { _interpreter = interpreter; _interpreter.UnloadingDomain += Interpreter_UnloadingDomain; _remote = _interpreter.Remote; _obj = obj; }
private AppDomain CreateDomain(out RemoteInterpreterProxy remoteInterpreter) { // We create a sacrificial domain for loading all of our assemblies into. AppDomainSetup setup = new AppDomainSetup(); setup.ShadowCopyFiles = "true"; // We are in ...\Extensions\Microsoft\IronPython Interpreter\2.0 // We need to be able to load assemblies from: // Python Tools for Visual Studio\2.0 // IronPython Interpreter\2.0 // // So setup the application base to be Extensions\Microsoft\, and then add the other 2 dirs to the private bin path. setup.ApplicationBase = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))); setup.PrivateBinPath = Path.GetDirectoryName(typeof(IronPythonInterpreter).Assembly.Location) + ";" + Path.GetDirectoryName(typeof(IPythonFunction).Assembly.Location); setup.PrivateBinPathProbe = ""; var domain = AppDomain.CreateDomain("IronPythonAnalysisDomain", null, setup); domain.AssemblyResolve += IronPythonResolver.domain_AssemblyResolve; remoteInterpreter = (RemoteInterpreterProxy)domain.CreateInstanceAndUnwrap( typeof(RemoteInterpreterProxy).Assembly.FullName, typeof(RemoteInterpreterProxy).FullName); return(domain); }
private static readonly string _noDefaultValue = "<No Default Value>"; // sentinel value to mark when an object doesn't have a default value public IronPythonParameterInfo(IronPythonInterpreter interpreter, ObjectIdentityHandle parameterInfo) { _interpreter = interpreter; _interpreter.UnloadingDomain += Interpreter_UnloadingDomain; _remote = _interpreter.Remote; _parameterInfo = parameterInfo; }
public IronPythonConstructorFunction(IronPythonInterpreter interpreter, ObjectIdentityHandle[] infos, IPythonType type) { _interpreter = interpreter; _interpreter.UnloadingDomain += Interpreter_UnloadingDomain; _remote = _interpreter.Remote; _infos = infos; _type = type; }
public IronPythonBuiltinFunctionTarget(IronPythonInterpreter interpreter, ObjectIdentityHandle overload, IronPythonType declType) { Debug.Assert(interpreter.Remote.TypeIs <MethodBase>(overload)); _interpreter = interpreter; _interpreter.UnloadingDomain += Interpreter_UnloadingDomain; _remote = _interpreter.Remote; _overload = overload; _declaringType = declType; }
private AppDomain CreateDomain(out RemoteInterpreterProxy remoteInterpreter) { // We create a sacrificial domain for loading all of our assemblies into. var ironPythonAssemblyPath = Path.GetDirectoryName(_factory.Configuration.GetWindowsInterpreterPath()); AppDomainSetup setup = new AppDomainSetup(); setup.ShadowCopyFiles = "true"; // We are in ...\Extensions\Microsoft\IronPython Interpreter\2.0 // We need to be able to load assemblies from: // Python Tools for Visual Studio\2.0 // IronPython Interpreter\2.0 // // So setup the application base to be Extensions\Microsoft\, and then add the other 2 dirs to the private bin path. setup.ApplicationBase = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))); setup.PrivateBinPath = Path.GetDirectoryName(typeof(IronPythonInterpreter).Assembly.Location) + ";" + Path.GetDirectoryName(typeof(IPythonFunction).Assembly.Location) + ";" + Path.Combine(ironPythonAssemblyPath, "DLLs") + ";" + ironPythonAssemblyPath; setup.PrivateBinPathProbe = ""; if (Directory.Exists(_factory.Configuration.GetPrefixPath())) { setup.AppDomainInitializer = IronPythonResolver.Initialize; setup.AppDomainInitializerArguments = new[] { _factory.Configuration.GetPrefixPath() }; } var domain = AppDomain.CreateDomain("IronPythonAnalysisDomain", null, setup); using (new RemoteAssemblyResolver(domain, ironPythonAssemblyPath)) { remoteInterpreter = (RemoteInterpreterProxy)domain.CreateInstanceAndUnwrap( typeof(RemoteInterpreterProxy).Assembly.FullName, typeof(RemoteInterpreterProxy).FullName); } #if DEBUG var assertListener = Debug.Listeners["Microsoft.PythonTools.AssertListener"]; if (assertListener != null) { var init = (AssertListenerInitializer)domain.CreateInstanceAndUnwrap( typeof(AssertListenerInitializer).Assembly.FullName, typeof(AssertListenerInitializer).FullName ); init.Initialize(assertListener); } #endif return(domain); }
private void Interpreter_UnloadingDomain(object sender, EventArgs e) { _remote = null; _interpreter.UnloadingDomain -= Interpreter_UnloadingDomain; }