【问题标题】:AppDomain assembly load causes Fatal Execution Engine Error (6B3979C6) (80131506)AppDomain 程序集加载导致致命的执行引擎错误 (6B3979C6) (80131506)
【发布时间】:2009-05-13 22:03:27
【问题描述】:

我们有一个类型缓存系统,以避免在每次应用程序启动时搜索所有插件程序集的所有类型,但是当从 .NET 1.1 移动到 2.0+ 时,事件日志会记录一个致命的执行引擎错误 ( AppDomain.Load() 上的 6B3979C6) (80131506)

如果和如果 1. AppDomain 不是 AppDomain.CurrentDomain。 2. 程序集不在可执行文件的目录中。

我们允许用户在特定于项目的目录中提供他们自己的程序集,因此我们无法解决 2。

我相信 1. 是需要的,因此我们可以在浏览类型后将 AppDomain 卸载到。

我不是此代码的所有者,但如果我没有提供足够的信息,我可以提出正确的问题。

此代码导致无法捕获的错误:

    private static void AddAssembly( System.AppDomain appDom, Manifest manifest, string filenameWithoutExtension )
    {
        try
        {
            // Test that the assembly can be loaded...
            System.Reflection.Assembly.ReflectionOnlyLoad(filenameWithoutExtension);

            System.Reflection.Assembly assem = appDom.Load( filenameWithoutExtension );
            ArrayList attributes = new ArrayList();
            //  System.Reflection.Assembly assem = System.Reflection.Assembly.LoadFrom(path+"\\"+file.Name);
            object[] attribs = assem.GetCustomAttributes( typeof(PlugInAttribute), false );
            if ( attribs.Length > 0 )
            {
                attribs = assem.GetCustomAttributes( false );
                foreach ( Attribute attr in attribs )
                {
                    object[] attrAttrs = attr.GetType().GetCustomAttributes(typeof(PlugInAttribute), false );
                    if ( attrAttrs.Length > 0 ) 
                    {
                        attributes.Add(attr.GetType().ToString());
                        break;
                    }
                }
            }
            if ( attribs.Length > 0 || attributes.Count > 0 )
            {
                Assembly assy = new Assembly( manifest );
                manifest.Assemblies.Add(assy);
                assy.Name = filenameWithoutExtension;
                assy.Version = AssemblyName.GetAssemblyName( System.IO.Path.Combine( manifest.Path, filenameWithoutExtension + ".dll") ).Version.ToString();
                assy.Attributes = (ArrayList)attributes.Clone();
                System.Type[] types = assem.GetTypes();
                foreach (System.Type type in types )
                    if ( !type.IsNestedPrivate && !type.IsNestedPublic
                        && !type.IsNestedAssembly  )
                        assy.AddType( type );
            }
        }
        catch ( Exception ex )
        {
            System.Diagnostics.Trace.WriteLine( "Manifest.AddAssembly Exception: " + ex.Message );

            Manager.WriteException(ex);
        }
    }

【问题讨论】:

    标签: .net assemblies appdomain


    【解决方案1】:

    这是由第三方许可库将错误代码注入进程造成的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-17
      • 2011-05-12
      • 1970-01-01
      • 2010-09-27
      • 2010-10-16
      • 1970-01-01
      • 2013-06-28
      • 1970-01-01
      相关资源
      最近更新 更多