Build Failed - Cannot deserialize

ajhartleyajhartley Posts: 3
edited July 29, 2011 8:23AM in SmartAssembly
My project is failing to build in SmartAssembly, giving the error:

Build Failed
The build process failed during the preparation of the resulting assembly.
Cannot deserialize object of type 'System.Collections.Generic.List`1Pacific.Core.Descriptor.BaseObjectDescriptor, Interface, Version=2.0.4217.26108, Culture=neutral, PublicKeyToken=9bb46428258d97e6, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089': Object of type 'Type1c2374e4de494253bfb10315d5c66a03[]' cannot be converted to type 'Pacific.Core.Descriptor.BaseObjectDescriptor[]'.

The smart assembly configuration only has error reporting enabled, we do not use obfuscation or dependency merging. The build was working as part of our TFS build process, but just stopped working on one particular changeset. Weirdly, that changeset did not touch the file complained about here!

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Thanks for your post. All we know so far, is the original error occurred because the assembly "Interface" could not be found, so the type conversion could not be done. We had to work this out using a debugger.

    After putting the assembly where SmartAssembly could find it, we got an error about a failure to deserialize because the target runtime was newer than the one loaded into the AppDomain created to do the operation.
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    The problem turned out to be that there were some .net 2 resources automatically created by Visual Studio and embedded in the executable. Since the assembly "Interfaces" and the main executable were targeted at .Net 4, the analysis failed. Normally this would only affect the "merging" feature, but due to the way SmartAssembly was designed, this analysis is done regardless of whether you are merging or not.

    As a workaround, there is an undocumented switch you can use in the SmartAssembly project file.
    <Options>
        <DoNotUpdateResources />
        ...
    </Options>
    
  • I've got this back up and running in our build system using your fix. Thanks for your hard work Brian over the last 2 days!
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    I'm glad we were able to get there in the end!
Sign In or Register to comment.