ITask程序集在共享类库中定义,初衷是任务调度程序,创建新的可卸载ALC以供每一个任务运行,此时会出现两个问题:

  1. 任务调度程序加载了任务程序后,任务程序中的ITask类型和任务调度程序中的ITask类型不是同一个类型。
  2. 若在可回收的ALC中使用Xml序列化,会报异常:A non-collectible assembly may not reference a collectible assembly.

问题2的堆栈跟踪

at System.Reflection.Emit.ModuleBuilder.GetTypeRef(QCallModule module, String strFullName, QCallModule refedModule, String strRefedModuleFileName, Int32 tkResolution)

at System.Reflection.Emit.ModuleBuilder.GetTypeRefNested(Type type, Module refedModule, String strRefedModuleFileName)

at System.Reflection.Emit.ModuleBuilder.GetTypeTokenWorkerNoLock(Type type, Boolean getGenericDefinition)

at System.Reflection.Emit.ModuleBuilder.GetTypeTokenInternal(Type type, Boolean getGenericDefinition)

at System.Reflection.Emit.ILGenerator.Emit(OpCode opcode, Type cls)

at System.Xml.Serialization.CodeGenerator.Castclass(Type target)

at System.Xml.Serialization.CodeGenerator.InternalConvert(Type source, Type target, Boolean isAddress)

at System.Xml.Serialization.SourceInfo.InternalLoad(Type elementType, Boolean asAddress)

at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElement(SourceInfo source, ElementAccessor element, String arrayName, Boolean writeAccessor)

at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElements(SourceInfo source, String enumSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, String arrayName, Boolean writeAccessors, Boolean isNullable)

at System.Xml.Serialization.XmlSerializationWriterILGen.WriteMember(SourceInfo source, String choiceSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc memberTypeDesc, Boolean writeAccessors)

at System.Xml.Serialization.XmlSerializationWriterILGen.GenerateTypeElement(XmlTypeMapping xmlTypeMapping)

at System.Xml.Serialization.XmlSerializationWriterILGen.GenerateElement(XmlMapping xmlMapping)

at System.Xml.Serialization.TempAssembly.GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace)

at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location)

at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace, String location)

at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)

at System.Xml.Serialization.XmlSerializer..ctor(Type type)

问题1:

可收集ACL中也加载了一份ITask所在的程序集,而宿主程序中也加载了一份,因此.net core认为不是同一个类型。

在可收集ACL的Load方法中,跳过加载ITask所在程序集即可,这样当可收集ACL需要使用ITask程序集时,会从宿主程序中查找,即Load方法返回null时对应的程序集都会从宿主程序中查找。

问题2:

.NET5 Preview1中会解决Xml序列化的问题

github上的issues,其中就有提到这两个问题

https://github.com/dotnet/runtime/issues/1388

可收集ALC问题[A non-collectible assembly may not reference a collectible assembly.]的更多相关文章

  1. 【Assembly】NO.70.EBook.7.Assembly.1.001-【汇编语言 第3版 张爽】- 基础知识

    1.0.0 Summary Tittle:[Assembly]NO.70.EBook.7.Assembly.1.001-[汇编语言 第3版 张爽]- 基础知识 Style:Assembly Serie ...

  2. Change Assembly Version in a compiled .NET assembly

    Change Assembly Version in a compiled .NET assembly You can use ILMerge: ILMerge.exe Foo.dll /ver:1. ...

  3. ASP.NET corrupt assembly “Could not load file or assembly App_Web_*

    以下是从overFlow 复制过来的问题 I've read through many of the other questions posted on the same issue, but I s ...

  4. .NET 程序集Assembly使用

    概述 一直以来,我们都在用C#编写程序,编写程序的时候,我们用到继承.多态.接口以及泛型,我们也都明白子类可以继承抽象类,并能够重写父类的抽象方法,可是大家是否想过,如下几个问题: 1.凡树必有根和叶 ...

  5. 加载dll过程中assembly失败

    错误现象: 进行插件读取时出现错误:“尝试从一个网络位置加载程序集,在早期版本的 .NET Framework 中,这会导致对该程序集进行沙盒处理.此发行版的 .NET Framework 默认情况下 ...

  6. [转]C#反射-Assembly.Load、LoadFrom与LoadFile进阶

    关于.NET中的反射,常用的有三个方法: Assembly.Load()Assembly.LoadFrom()Assembly.LoadFile() 下面说说这三个方法的区别和一些细节问题 1. As ...

  7. No assembly found containing an OwinStartupAttribute

    自从在ASP.NET MVC中使用NuGet添加SignalR类库之后,再次运行程序时,它出现了一个异常: Server Error in '/' Application. The following ...

  8. 慎用Assembly.LoadFile()和Assembly.LoadFrom()

    经测这俩方法会锁住文件,导致程序运行期间无法对load过的程序集文件进行更名/删除/覆盖等等操作,考虑用Assembly.Load()文件字节组替代: Assembly.Load(File.ReadA ...

  9. sbt的assembly插件使用(打包所有依赖)

    1.sbt是什么 对于sbt 我也是小白, 为了搞spark看了一下scala,学习scala时指定的构建工具就是sbt(因为sbt也是用scala开发的嘛),起初在我眼里就是一个maven(虽然ma ...

  10. How to upgrade workflow assembly in MOSS 2007

    This problem generally start when you are having an existing custom workflow and there are instances ...

随机推荐

  1. 【TS】接口和接口继承

    接口 接口也相当于语法规范,在使用ts编写的时候,需要注重的就是数据类型以及语法规范,恰好这里提供了一个接口,在进行传值的时候,传值的类型以及字段必须符合我们预期的类型规范才可以,下面是代码演示 语法 ...

  2. ArcGIS Pro SDK 002 对数据文件的读取和操作

    做系统开发或者数据处理的时候,我一般还是喜欢使用文件数据源,例如矢量用.shp文件存储,栅格数据用.tif或者.img文件存储.ArcGIS Pro SDK中对数据源操作的API和ArcObjects ...

  3. clicknium-划时代的自动化

    说起UI自动化,selenium一直是不可替代的存在,它的安装量.百度数量已经奠定了它在自动化.爬虫等相关领域的霸主低位,可以说,只要涉及到UI自动化,选selenium就对了. 细数过往,相关的UI ...

  4. JZOJ 2645. 【NOIP2011模拟11.1】钓鱼

    题面 分析 状压 \(dp\) 直接上啊! 设 \(f_{t,S,pos}\) 表示 \(t\) 这个时刻之前能钓到的最多的鱼的数量 那么当前为可以钓鱼也可以移动 于是一切都明朗了 \(Code\) ...

  5. 优化 Win11 资源管理器打开文件夹速度

    打开"高级系统设置",点击"性能"设置,性能选项中勾选如上图选中的项,可以一定程度上提升 Win11 资源管理器打开文件夹的速度: "窗口内动画控件和 ...

  6. 让启动的jar包能打断点

    java  -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar rbpsems-web-2.0.0-SNAP ...

  7. 1055. Combinations

    1055. Combinations Time limit: 1.0 secondMemory limit: 64 MB As you have known MMM corporation lab r ...

  8. How to Use Arrays and Vectors

    array it needs a constant value const int seq_size = 18; int pell_seql[seql_size]; //defined a const ...

  9. JS 动态获取 Url 参数(封装函数)

    话不多说直接上代码: 封装函数如下: (如果urls固定,可以只写一个name变量) getQueryString(name, urls) { var url = urls; // 获取URL // ...

  10. webpack5基础用法2

    webpack的基础用法2 webpack的优化方向 提升开发体验 提升打包构建速度 减少代码体积 优化代码运行性能 SourceMap 生成一个.map文件,形成一个映射, 可以通过错误找到源文件 ...