What type of things can cause sgen msbuild task to fail intermittantly with Access Violation?

Posted by Mark Allanson on Stack Overflow See other posts from Stack Overflow or by Mark Allanson
Published on 2010-04-23T14:25:44Z Indexed on 2010/05/21 15:50 UTC
Read the original article Hit count: 384

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about msbuild