I have IronPython embedded inside a C# application. I let users write IronPython scripts, in which they can import a set of the standard libraries shipped with IronPython. In these scripts when a user imports the "random" library or the "filecmp" library, an unhandled GeneratorExitException is thrown.
Other libraries like math, re, string and os are importable by users without any issues.
This is the stack trace which I get:
IronPython.dll!IronPython.Runtime.PythonGenerator.ThrowThrowable() + 0x85 bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.CheckThrowable() + 0x27 bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.CheckThrowableAndReturnSendValue() + 0x3c bytes
IronPython.dll!IronPython.Runtime.Operations.PythonOps.GeneratorCheckThrowableAndReturnSendValue(object self = {IronPython.Runtime.PythonGenerator}) + 0x49 bytes
Snippets.debug.scripting!S$12.lambda_method$344(ref int state = -1, ref object current = null) + 0x124 bytes Unknown
Microsoft.Scripting.dll!Microsoft.Scripting.Runtime.GeneratorEnumerator<object>.System.Collections.IEnumerator.MoveNext() + 0x3c bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.MoveNextWorker() + 0xa3 bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.System.Collections.IEnumerator.MoveNext() + 0x42 bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.throw(object type = {"Exception of type 'IronPython.Runtime.Exceptions.GeneratorExitException' was thrown."}, object value = null, object traceback = null) + 0xb5 bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.throw(object type = {"Exception of type 'IronPython.Runtime.Exceptions.GeneratorExitException' was thrown."}) + 0x2a bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.close() + 0x56 bytes
IronPython.dll!IronPython.Runtime.PythonGenerator.Finalize() + 0x42 bytes
Has anyone faced a similar problem? And what's the solution?
EDIT This only happens when the Visual Studio debugger is attached.