views:

149

answers:

1

In our MSBuild file for our project we sgen an assembly containing classes used during xml serialization. The classes are generated via xsd.exe.

We use the following SGen task configuration.

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

Intermittantly the following error is thrown when executing the msbuild script on our build server. Originally this error might have occurred once out of every 50 (CI) builds, recently the frequency has been increasing and it now occurs maybe 5-6 out of every 10 builds.

The size of the assembly that is being Sgenned is about 410k (circa 35,000 lines of generated code), and when successfull the serialization assembly is about 1.7M in size.

When it fails, the output is as follows:

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.

We are using Hudson to manage our builds, so the msbuild and sgen processes are therefore spwaned by the Hudson.exe.

There's not much out there on the interwebs regarding this type of error from SGen. Certainly nothing concrete.

+1  A: 

It appears this was caused by the 32-bit version of the Java Runtime Environment spawning the instance of sgen.exe. The build server is running dual Opterons on Windows Server 2003 x64.

Switching to the 64-bit version of the JRE seems to have fixed the problem with the random AccessViolationExceptions.

Lloyd Braun
The above didn't fix the problem, it turns out. Further builds started after using the 64-bit JRE still resulted in the same sgen issues. The search continues...
Lloyd Braun