2

The question is: since it is obvious that my assembly is not mixed mode, what else can cause "Mixed mode assembly" exception?

Details:

I have a pure .net executable assembly hosts wcf services. I checked that it is pure .net assembly by the method found in this post

Also I checked all referenced assemblies and for all of them was the same CorFlags output.

There is an output of ildasm and corflags

//  Microsoft (R) .NET Framework IL Disassembler.  Version 4.0.30319.17929     
...
// ----- CLR Header:                                                                                                             
// Header size:                        0x00000048                                                                                
// Major runtime version:              0x0002                                                                                    
// Minor runtime version:              0x0005                                                                                    
// 0x00002aec [0x00003128] address [size] of Metadata Directory:                                                                 
// Flags:                              0x00000009            

Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.17929                                                 
Version   : v2.0.50727                                                                                                           
CLR Header: 2.5                                                                                                                  
PE        : PE32                                                                                                                 
CorFlags  : 0x9                                                                                                                  
ILONLY    : 1                                                                                                                    
32BITREQ  : 0                                                                                                                    
32BITPREF : 0                                                                                                                    
Signed    : 1    

It runs with the following app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" />
    <supportedRuntime version="v2.0.50727" />
  </startup>
 </configuration>

On all our test configurations it runs good. But on the machine of one customer it fails with exception

System.IO.FileLoadException: Mixed mode assembly is built against version
'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without
additional configuration information.

Unfortunately this customer does not allow us remote debugging of this problem.

The question is: since it is obvious that my assembly is not mixed mode, what else can cause the same exception?

Community
  • 1
  • 1
Ed Pavlov
  • 2,353
  • 2
  • 19
  • 25
  • 1
    Pretty little evidence that it is actually your assembly that generates this exception. Could be another one that's getting injected into your process, somehow. A C++/CLI assembly that targets CLR v2.0, it will certainly fail like this since it requires the useLegacyV2RuntimeActivationPolicy="true" attribute in the startup element. If you can't debug it then it is of course up to the customer's IT staff to narrow it down. SysInternals' Process Monitor is the essential tool. – Hans Passant Apr 13 '14 at 17:46
  • "Could be another one that's getting injected into your process, somehow" It sounds very similar to the truth, thanks – Ed Pavlov Apr 13 '14 at 19:09

0 Answers0