At one of our customers, our application, that was build with the .Net Framework 2.0, always gets started with .Net Framework 4.0.
This causes a crash in a 3rd party assembly (Telerik).
We already created a CLR Load Log:
5568,1726707.515,CLR Loading log for C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe
5568,1726707.515,Log started at 09:26:15 on 07.01.2016
5568,1726707.515,-----------------------------------
5568,1726707.515,FunctionCall: _CorExeMain
5568,1726707.515,FunctionCall: ClrCreateInstance, Clsid: {2EBCD49A-1B47-4A61-B13A-4A03701E594B}, Iid: {E2190695-77B2-492E-8E14-C4B3A7FDD593}
5568,1726707.515,MethodCall: ICLRMetaHostPolicy::GetRequestedRuntime. Version: (null), Metahost Policy Flags: 0x1168, Binary: (null), Iid: {BD39D1D2-BA2F-486A-89B0-B4B0CB466891}
5568,1726707.515,Installed Runtime: v2.0.50727. VERSION_ARCHITECTURE: 0
5568,1726707.515,Installed Runtime: v4.0.30319. VERSION_ARCHITECTURE: 0
5568,1726707.515,Input values for ComputeVersionString follow this line
5568,1726707.515,-----------------------------------
5568,1726707.515,Default Application Name: C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe
5568,1726707.515,IsLegacyBind is: 0
5568,1726707.515,IsCapped is 0
5568,1726707.515,SkuCheckFlags are 0
5568,1726707.515,ShouldEmulateExeLaunch is 0
5568,1726707.515,LegacyBindRequired is 0
5568,1726707.515,-----------------------------------
5568,1726707.515,Parsing config file: C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe.config
5568,1726707.515,Config File (Open). Result:00000000
5568,1726707.515,Config File (Read). Result:00000000
5568,1726707.515,Found config file: C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe.config
5568,1726707.515,UseLegacyV2RuntimeActivationPolicy is set to 0
5568,1726707.515,FindLatestVersion is returning the following version: v4.0.30319 Input VERSION_ARCHITECTURE: 0, V2.0 Capped: 0
5568,1726707.515,Default version of the runtime on the machine: v4.0.30319
5568,1726707.515,Decided on runtime: v4.0.30319
...
As you can see, the Version, the application was build with, is not taken into account.
Why ? Is there any Setting, that may cause this ?
We than decided to put a define the Framework Version to use in a config file, using supportedRuntime.
The result is the following CLR Load Log:
312,1810559.703,CLR Loading log for C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe
312,1810559.703,Log started at 08:43:49 on 08.01.2016
312,1810559.703,-----------------------------------
312,1810559.703,FunctionCall: _CorExeMain
312,1810559.703,FunctionCall: ClrCreateInstance, Clsid: {2EBCD49A-1B47-4A61-B13A-4A03701E594B}, Iid: {E2190695-77B2-492E-8E14-C4B3A7FDD593}
312,1810559.718,MethodCall: ICLRMetaHostPolicy::GetRequestedRuntime. Version: (null), Metahost Policy Flags: 0x1168, Binary: (null), Iid: {BD39D1D2-BA2F-486A-89B0-B4B0CB466891}
312,1810559.718,Installed Runtime: v2.0.50727. VERSION_ARCHITECTURE: 0
312,1810559.718,Installed Runtime: v4.0.30319. VERSION_ARCHITECTURE: 0
312,1810559.718,Input values for ComputeVersionString follow this line
312,1810559.718,-----------------------------------
312,1810559.718,Default Application Name: C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe
312,1810559.718,IsLegacyBind is: 0
312,1810559.718,IsCapped is 0
312,1810559.718,SkuCheckFlags are 0
312,1810559.718,ShouldEmulateExeLaunch is 0
312,1810559.718,LegacyBindRequired is 0
312,1810559.718,-----------------------------------
312,1810559.718,Parsing config file: C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe.config
312,1810559.718,Config File (Open). Result:00000000
312,1810559.718,Config File (Read). Result:00000000
312,1810559.718,Found config file: C:\Program Files (x86)\windream GmbH\windream\Windream.Find.WinForms.exe.config
312,1810559.718,UseLegacyV2RuntimeActivationPolicy is set to 0
312,1810559.718,Config file includes SupportedRuntime entry. Version: v2.0.50727, SKU: (null)
312,1810559.718,FindLatestVersion is returning the following version: v4.0.30319 Input VERSION_ARCHITECTURE: 0, V2.0 Capped: 0
312,1810559.718,Default version of the runtime on the machine: v4.0.30319
312,1810559.718,Decided on runtime: v4.0.30319
It even sees the SupportedRuntime in the config file, but still decides to use the wrong runtime Version.
Does anybody know a possible reason for this strange behaviour ?
Additional info: the machine is running Server 2012 R2 with Citrix XenApp 6.5
Regards,
Uwe Honermann
windream GmbH