Question

I'm getting the following exception in our virtualized application packaged using Spoon Studio and .Net 4.0

Exception='System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\temp\Serialization\mf3je3jx.dll' or one of its dependencies. The system cannot find the file specified.
File name: 'file:///C:\temp\Serialization\mf3je3jx.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
   at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
   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.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)

This was working fine till we were using .Net 3.5 but after migrating to .Net 4.0 package we've started seeing this error.

I understand that the one way to solve this is to pre-generate XmlSerializers but in our case we've multiple add-ins which also needs to be rebuilt and we want to avoid doing that.

My question is why is this happening at all? Why is runtime not able to generate the serializers at runtime? I can see .cs and .out files being generated in the temp directory (dll is also generated momentarily and deleted immediately).

If I run my application without virtualization it works fine and able to build and load in-memory serializers. User running the application is same in both of the cases.

Any suggestion are welcomed.

It's a separate problem but I'm unable to debug this within VS or windbg (I get clr version mismatch error b/w VS and Application)

reason being: installing VS12/.Net 4.5 on the machine upgrades the CLR version number to 4.0.30319.17929 whereas application uses 4.0.30319.1. and VS doesn't allow me to attach to this application

Was it helpful?

Solution

We've found the issue.

Default .Net Image used by Spoon Studio for .Net 4.0 doesn't have all the required assemblies in it.

This is a bug in Spoon Studio. I got it working by getting a new custom image from the SpoonStudio team.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top