Serialization System.InvalidProgrameException:公共语言运行库检测到无效程序

Serialization System.InvalidProgrameException:公共语言运行库检测到无效程序,serialization,clr,zeroformatter,Serialization,Clr,Zeroformatter,全部, 我正在使用ZeroFormatter对一个大对象进行序列化,有时在序列化错误时会出现以下错误,在使用ZeroFormatter的联合概念进行继承后,会发现这个问题 以下是例外情况的详细信息: System.InvalidProgrameException:公共语言运行库检测到无效程序。 在ZeroFormatter.DynamicObjectSegments.ZeroFormatter\u Formatters\u DefaultResolver.Colibrium.Common.Ont

全部,

我正在使用ZeroFormatter对一个大对象进行序列化,有时在序列化错误时会出现以下错误,在使用ZeroFormatter的联合概念进行继承后,会发现这个问题

以下是例外情况的详细信息:

System.InvalidProgrameException:公共语言运行库检测到无效程序。
在ZeroFormatter.DynamicObjectSegments.ZeroFormatter\u Formatters\u DefaultResolver.Colibrium.Common.Ontology.Rating.Factors.RateFactor$Formatter.Serialize(字节[]和Int32,RateFactor)
在ZeroFormatter.Formatters.CollectionFormatter
3.序列化(字节[]和字节,Int32偏移量,TCollection值)
在ZeroFormatter.DynamicObjectSegments.ZeroFormatter\u Formatters\u DefaultResolver.Colibrium.Common.Ontology.Rating.RateClass$Formatter.Serialize(字节[]和,Int32,RateClass)
在ZeroFormatter.Formatters.CollectionFormatter上
3.序列化(字节[]和字节、Int32偏移量、TCollection值)
在ZeroFormatter.DynamicObjectSegments.ZeroFormatter\u Formatters\u DefaultResolver.Colibrium.Common.Ontology.Rating.PackagePlan$Formatter.Serialize(字节[]和,Int32,PackagePlan)
在ZeroFormatter.Formatters.CollectionFormatter
3.序列化(字节[]和字节,Int32偏移量,TCollection值)
在ZeroFormatter.DynamicObjectSegments.ZeroFormatter_Formatters_DefaultResolver.Colibrium.Common.Ontology.Rating.Package$Formatter.Serialize(字节[]&,Int32,Package)
在ZeroFormatter.Formatters.CollectionFormatter上
3.序列化(字节[]和字节、Int32偏移量、TCollection值)
在ZeroFormatter.DynamicObjectSegments.ZeroFormatter\u Formatters\u DefaultResolver.Colibrium.Common.Ontology.Rating.PackageGroup$Formatter.Serialize(字节[]和,Int32,PackageGroup)
在ZeroFormatter.Formatters.CollectionFormatter
3.序列化(字节[]和字节,Int32偏移量,TCollection值)
在ZeroFormatter.DynamicObjectSegments.ZeroFormatter\u Formatters\u DefaultResolver.Colibrium.Common.Ontology.Rating.Group.GroupRatingResults$Formatter.Serialize(字节[]&,Int32,GroupRatingResults)
在ZeroFormatter.ZeroFormatterSerializer.CustomSerializer上 在Colibrium.Utility.Library.ObjectConverter`1.ConvertO 对象二进制分析器(T p_对象)

在C:\TFS\UPMC\Repos\Colibrium.Utility.Library\ObjectConverter.cs中:第407行


查看源代码,该库试图通过在运行时生成CLR类型来优化用户类型的格式设置,从而将用户类型序列化/反序列化为字节数组。基于这个错误,看来这一代IL中一定有一个bug


您应该在中报告此问题,但请注意,您可能需要有一个好的方法来重现此问题,因为跟踪
InvalidProgrameException
非常具有挑战性。

如果您碰巧使用了应用程序洞察,则可能会由于以下原因引发异常:

这个问题在.NETCore上有报道,但我也在.NETFramework上有报道,因为解决方案似乎也在那里起作用

ApplicationInsights已经转向预安装的站点扩展模型,不再有令人不快的地方。此外,私有站点扩展将不会更新,因为估计它将在一个月内被弃用。您应该能够通过Azure中AppService刀片中的ApplicationInsights配置升级到预安装的站点扩展

但是,如果要立即解决专用站点扩展的问题,可以通过删除站点扩展中的以下两个文件并重新启动站点来解决此问题:

  • Instrumentation32\ProductionBreakpoints_x86.config
  • Instrumentation64\ProductionBreakpoints\u x64.config
这将有效地删除导致问题的AppInsights扩展部分