Joined: 06 Oct 2008
|Posted: Thu Nov 07, 2013 3:57 pm Post subject: SmartAssembly encountered an invalid symbol in mscorlib
|WARNING: Long post ahead, lots of details
When I process my main application with SmartAssembly 22.214.171.124, I get the following error:
SmartAssembly has encountered an error while running your project.
Failed: SmartAssembly.InformationException: SmartAssembly has encountered an invalid symbol:
The most likely cause is that SmartAssembly has used a different version of a dependency from the version used by Axciton.exe.
If the details below are wrong, please use the MandatoryPath attribute in the .saproj file to ensure that the correct version of the dependency is found.
Assembly that should contain the missing symbol: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\mscorlib.dll
Please run SmartAssembly in User-Interface mode for more information.
I get this error when running SA as a postbuild event from VS2010 Pro SP1, or when I use the SA user interface.
I've seen a few forum posts about a similar error, and the solutions involved upgrading SA, but I'm already running the latest version.
I've narrowed it down to one specific dependency on my project. We have a library we built that is a "merged dependency" in the SA project, although this dependency is not obfuscated. When I rebuild this dependency, I get the above error when processing my application. If I exclude this dependency from being merged, I do not get the SA error.
A couple of (admittedly strange) notes about this dependency:
1. A portion of the project is written in IL, and assembled into a binary used a reference.
2. It uses ILDasm to get the IL of the resulting C# binary.
3. It uses a PowerShell script to modify the IL (to use features allowed by the IL, but not in C#)
4. It uses ILAsm to reassemble the modified IL into a new binary.
This is the only dependency that when I rebuild it, I get the above error. It is also the only dependency that uses ILAsm and ILDasm as build events.
The only thing I can think of that changed on my system is I installed the Windows 7.1 SDK. As part of this, I had to uninstall the VC++ 2010 Redist, install the SDK, install a patch for the VC++ compiler, then reinstall the VC++ redist. However, I restored my machine to an earlier backup before this had been done, verified I did NOT get the attribute error, then reinstalled the SDK, and still did not get the error. So I'm at a loss as to what the cause is.
I've also tried reproducing the issue with ONLY the problem dependency and a simple project that includes it, using the same SA project settings as my main project, but I've been unable to reproduce it. Due to confidentiality concerns, I cannot provide the main application for troubleshooting, but I can provide the problem dependency if needed.