Created
December 9, 2014 18:00
-
-
Save ironpythonbot/29a792902edac0fafefd to your computer and use it in GitHub Desktop.
CodePlex Issue #32530 Plain Text Attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using IronPython.Hosting; | |
using Microsoft.Scripting.Hosting; | |
class Program | |
{ | |
static void Main() | |
{ | |
ScriptEngine engine = Python.CreateEngine(); | |
ScriptScope scope = engine.CreateScope(); | |
// The following internally throws (and catches) a MissingMemberException, | |
// causing VS to break, (if in VS menu "Debug", "Exceptions...", "Common Language Runtime Exceptions", "System", column "Thrown" is checked for row "System.MissingMemberException") | |
// and printing this message to the Debug log: | |
// A first chance exception of type 'System.MissingMemberException' occurred in Anonymously Hosted DynamicMethods Assembly | |
bool b = scope.ContainsVariable("nonexisting"); | |
Console.WriteLine("scope.ContainsVariable(\"nonexisting\") = {0}", b); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using IronPython.Hosting; | |
using Microsoft.Scripting.Hosting; | |
class Program | |
{ | |
static void Main() | |
{ | |
var engine = Python.CreateEngine(); | |
var storage = new Dictionary<string, object>(); | |
var scope = engine.CreateScope(storage); | |
engine.Execute("existing = 5", scope); | |
var a = storage.ContainsKey("existing"); | |
var b = storage.ContainsKey("nonexisting"); | |
Console.WriteLine("scope.ContainsVariable(\"existing\") = {0}", a); | |
Console.WriteLine("scope.ContainsVariable(\"nonexisting\") = {0}", b); | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment