2011-08-06 40 views
0

我正在C#中开发一个绘图应用程序,我打算使用IronPython作为应用程序的脚本扩展。我已经成功地使用了IronPython几个月,大多数用户没有任何问题,但是一小部分用户遇到问题。IronPython:TopNamespaceTracker.PublishComTypes引发AccessViolationException

在其中一个人的帮助下,我设法挖掘了异常堆栈跟踪。

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) 

我找不到在谷歌任何可能与此有关:当调用Python.CreateEngine()方法发生异常。 有关用户环境中的某些信息:

  • 的Win7 64位
  • 使用.NET 2.0-3.5(不是4.0)
  • IronPython的没有安装在GAC中,应用程序使用组件在本地磁盘上(V 2.6 0.2)
  • 用户运行的应用程序作为普通用户(非管理员)

我用的Win7 64位自己,但我没有任何这样的问题。

回答

1

异常发生在IronPython的COM互操作代码中的某处,但我不完全确定为什么 - 发生异常的代码将COM类型从互操作程序集中拉出。你将不得不(在某种程度上)弄清楚什么样的程序集在异常发生时正在AppDomain中加载,这可能需要实时调试或定制的IronPython版本。

我不确定这是IronPython中的一个错误,还是用户机器上有一个引起IronPython破坏的松鼠COM对象,但我的猜测是后者。

相关问题