UPDATE - October 12th 2015:
The Roslyn team have fixed this issue in Visual Studio 2015 Update 1, with a CTP build available now!
TL;DR; You may be unable to build a solution that references the Zimbra Social DLLs after upgrading to Visual Studio 2015, and receive a "Failed to Emit Module" message. This only happens if you call certain methods. Currently there is no fix available for this, you can either use an earlier version of Visual Studio, or update the calls to the methods (see below).
I've been using the Visual Studio 2015 Release Candidate to work with Zimbra Community projects for a little while and everything has been great (the tools for running grunt etc. in 2015 are really helpful), a few weeks ago when the final version of VS 2015 was released another developer on the team installed it straight away, and was then unable to build the solution, always receiving the following error:
CSC : error CS7038: Failed to emit module
I was still running the Release Candidate and the same code work for me, I updated to the RTM version on one machine and then saw the same error! After much head scratching and googling found this post on stack overflow and an issue on the Roslyn (the new compiler used in VS 2015) Github repository, which showed that others were seeing a similar problem, but nobody knew why.
After some trial and error found that the problematic code was calling methods with default parameters, such as:
Removing all instances of this type of call allowed the solution to build again!
In the Roslyn issue discussion with others who were experiencing this problem, a pattern started to emerge, showing the error was down to calling methods with default parameters, that are contained in assemblies obfuscated using RedGate Smart Assembly 6.8 or below. Zimbra Support confirmed that they are using version 6.8.
How to Fix The Issue
The underlying issue can be fixed by using the latest version of Smart Assembly (6.9), this would require a new release of all the Zimbra Community DLLs which is obviously something that would need to be tested and considered fully. Zimbra Support are aware of the issue and the fix, and will hopefully look at using the newer version of SmartAssembly in a hotfix or version 9.
I'm only aware of two workarounds for this issue:
- Use another version of Visual Studio (e.g. the 2015 RC, or 2013)
- Rewrite all calls to methods with default values to explicitly specify the value, e.g. rewrite the example above to be: