Monday, October 6, 2008

Bizarre error of the day

So I'm playing with compiling something which is C++/CLI using /clr, and ran across an error while trying to run:
'Could not load file or assembly' of my exe itself!

So to make a long story short, after some research, it turns out that:
- The .NET framework cannot load assemblies which have more than 65k global symbols defined
- Every static string in the code apparently is assigned its own global symbol when compiling with /clr

The solution, equally bizarre, is to enable string pooling for the Debug build of the exe. This reduces the amount of static strings dramatically, which allows the assembly to load, and the program to run. Talk about a random issue.

Oh, and obligatory "yeah, C++/CLI is ready for real world apps...".

No comments: