Wednesday, August 18, 2010

CRM 4.0 on 64 bit platform.

I was coding away the other day and ran into a real interesting problem. Here's the result of trying to create the CrmService object on a Window 2008r2 server:

System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS0001: Internal compiler error (0xc00000fd)
error CS0003: Out of memory

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)

This error message initially made me think that there was some permissions issue with the ASPNET user not being able to write to temp. That was not the case. I solved the problem by using sgen to create a .XmlSerializers.dll file. There was some issues with sgen not being able to handle spaces in the path to the key file. So I put everything needed into the same directory and ran sgen. Here's the parameters that I used:

sgen /compiler:/keyfile:keyfile.snk /p [offending].dll

Here's a link to sgen.

Have fun...

1 comment:

  1. Caleb,

    i know this is like 2 years later but i have the same problem.

    What "offending dll" should be specified? I'm not doing a plugin, I have a ASP.NET website that i'm publishing and want to throw it onto CRM 4.0 that will be displayed from an iframe.