What type of things can cause sgen msbuild task to fail intermittantly with Access Violation?
In our MSBuild file for our proje开发者_C百科ct 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.
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.
精彩评论