CRC error when running against Silverlight 5 xap


When attempting to process tests contained in a xap created with Silverlight 5 (runtime version 5.0.60401.0), I was getting the following error:
Sending signal to Lighthouse Test Executor to start executing tests.
Error occured: CRC error: the file being extracted appears to be corrupted. Expected 0x68DBCE13, Actual 0x00000000
So the problem turned out to be in the way that MS creates its xap files in SL5. By debugging the source I could see that the uncompressed size for the xap (zip) was not being written (during creation of the xap) to the expected location in the central directory header. Consequently DotNetZip library was unable to calculate the CRC and was failing with the above error.
To get around the problem, I compiled my own version of the Lighthouse source with a small change to the XapReader.Load(string xapFileFullPath) method that forces the zip library to perform a FullScan of the xap when it tries to read it in. This fixes the problem as it seems to handle where to get the uncompressed size from if not in its usual place (compared to SL4 at least).
NB. There is a comment in DotNetZip library code that states that use of the FullScan property should be avoided for large archives as it will increase the time to uncompress.
I have attached the modified XapReader.cs file. Hope this helps

file attachments


spavkov wrote Aug 16, 2011 at 11:53 AM


thanks a lot for submitting this i will include your fix in the next release which will support Silverlight 5.

wrote Aug 16, 2011 at 11:54 AM

wrote Feb 13, 2013 at 7:06 PM