哪种类型的东西会导致sgen msbuild任务间歇性地因访问冲突而失败?

时间:2010-04-23 14:25:45

标签: .net msbuild xsd.exe sgen sgen.exe

在我们项目的MSBuild文件中,我们创建了一个包含在xml序列化期间使用的类的程序集。这些类是通过xsd.exe生成的。

我们使用以下SGen任务配置。

<SGen ToolPath="$(SdkPath)" 
      ShouldGenerateSerializer="true" 
      UseProxyTypes="false" 
      BuildAssemblyName="AssemblyName.dll" 
      BuildAssemblyPath="Outputs" 
      ContinueOnError="false"  />

在我们的构建服务器上执行msbuild脚本时,会间歇性地引发以下错误。最初这个错误可能在每50个(CI)构建中出现一次,最近频率一直在增加,现在每10个构建中可能有5-6个。

正在处理的程序集的大小约为410k(大约35,000行生成的代码),成功时序列化程序集的大小约为1.7M。

失败时,输出如下:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
E:\Path_ToBuild_Workspace\SolutionBuild.MSBuild(74,5): error MSB6006: "sgen.exe" exited with code -1073741819.

我们正在使用Hudson来管理我们的构建,因此msbuild和sgen进程因此被Hudson.exe占用。

关于来自SGen的此类错误的互联网上没有太多内容。当然没什么具体的。

1 个答案:

答案 0 :(得分:2)

这似乎是由产生sgen.exe实例的32位版Java Runtime Environment引起的。构建服务器在Windows Server 2003 x64上运行双Opteron。

切换到64位版本的JRE似乎解决了随机AccessViolationExceptions的问题。