[Ironpython-users] AccessViolationException on Python.CreateEngine() call

Jeff Hardy jdhardy at gmail.com
Mon Aug 8 18:12:39 CEST 2011


Hi Igor,

The exception is occurring somewhere in IronPython's COM interop code,
but I'm not exactly sure why - the code where the exception occurred
pulls COM types out of interop assemblies. You'll have to (somehow)
figure out what assembly is getting loaded in the AppDomain when the
exception happens, which will probably require live debugging or a
custom IronPython build.

I'm not sure if it's a bug in IronPython, or if there's a squirrelly
COM object on the user's machine that causes IronPython to break, but
my guess is the latter.

- Jeff

P.S. I saw your SO question before this, but feel free to keep the
discussion where ever you prefer.

On Sat, Aug 6, 2011 at 11:12 PM, Igor Brejc <igor.brejc at gmail.com> wrote:
> Hi,
>
> I'm developing a cartography application (http://maperitive.net) in C#
> and I plan to use IronPython as a scripting extension of the
> application. I've been successfully using IronPython for several
> months and most users don't have any issues with it, but a small
> percentage of users is having problems.
>
> With the help from one of them I managed to dig out the exception
> stack trace. The exception occurs while calling the
> Python.CreateEngine() method:
>
> System.Reflection.TargetInvocationException: Exception has been thrown
> by the target of an invocation.
> ---> System.Reflection.TargetInvocationException:
> Failed to load language 'IronPython 2.6.2': Attempted to read or write
> protected memory. This is often an indication that other memory is
> corrupt.
> ---> System.AccessViolationException: Attempted to read or write
> protected memory. This is often an indication that other memory is
> corrupt.
> at Microsoft.Scripting.Actions.TopNamespaceTracker.PublishComTypes(Assembly
> interopAssembly)
> at IronPython.Runtime.Binding.PythonBinder.DomainManager_AssemblyLoaded(Object
> sender, AssemblyLoadedEventArgs e)
> at IronPython.Runtime.Binding.PythonBinder..ctor(PythonContext
> pythonContext, CodeContext context)
> at IronPython.Runtime.PythonContext..ctor(ScriptDomainManager manager,
> IDictionary`2 options)
> --- End of inner exception stack trace ---
> at Microsoft.Scripting.Runtime.LanguageConfiguration.LoadLanguageContext(ScriptDomainManager
> domainManager, Boolean& alreadyLoaded)
> at Microsoft.Scripting.Runtime.DlrConfiguration.LoadLanguageContext(ScriptDomainManager
> manager, LanguageConfiguration config)
> at Microsoft.Scripting.Runtime.DlrConfiguration.TryLoadLanguage(ScriptDomainManager
> manager, AssemblyQualifiedTypeName providerName, LanguageContext&
> language)
> at Microsoft.Scripting.Runtime.ScriptDomainManager.GetLanguageByTypeName(String
> providerAssemblyQualifiedTypeName)
> at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngineByTypeName(String
> assemblyQualifiedTypeName)
> at IronPython.Hosting.Python.GetEngine(ScriptRuntime runtime)
>
> I couldn't find anything on Google that would be related to this. Some
> info about the user's environment:
>
> - Win7 64bit
> - Using .NET 2.0-3.5 (not 4.0)
> - IronPython is not installed in GAC, the app uses assemblies locally
> on the disk (v 2.6.2)
> - The user runs the application as an ordinary user (not administrator)
>
> I use Win7 64bit myself, but I didn't have any such problems and I
> cannot reproduce this problem on any of my machines (Win7, Ubuntu).
>
> Thanks for any help,
> Igor Brejc
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
>


More information about the Ironpython-users mailing list