Search code examples
.netwindows-error-reporting

What is the "Framework Version" referenced in Windows Event Logs?


I'm debugging a C# application crash. The crash is happening in a call to an external, native DLL.

Windows Event Log contains the following report. I'm targeting .NET 4.5 (in Visual Studio) and the target PC has .NET 4.5.2 installed.

My question is: why does Framework Version indicate v4.0.30319? This looks to me like the application is running under the wrong .NET framework.

Application: XXXXXXX.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at XXXXXXX.SVcamApi+NativeMethods.SVInterfaceGetDeviceId_64(Void*, UInt32, SByte*, UInt32*)
   at XXXXXXX.SVcamApi+NativeMethods.SVInterfaceGetDeviceId_64(Void*, UInt32, SByte*, UInt32*)
   at XXXXXXX.SVcamApi.SVS_InterfaceGetDeviceId(IntPtr, UInt32, System.String ByRef, UInt32 ByRef)
   at XXXXXXX.XXXXXXX+Cameracontainer.deviceDiscovery()
   at XXXXXXX.XXXXXXX.buttonDiscover_Click(System.Object, System.EventArgs)
   at XXXXXXX.XXXXXXX.DiscoverAndConnect()
   at XXXXXXX.XXXXXXX..ctor()
   at XXXXXXX.Program.Main()

I've confirmed that 4.5.2 is installed using the Raymondcc .NET Detector utility: https://www.raymond.cc/blog/how-to-check-what-version-of-microsoft-net-framework-is-installed-in-computer/

Surprisingly, the .NET Detector indicates that 4.0 isn't even installed; it shows 2, 3, 3.5 and 4.5.2 as installed.


Solution

  • What you are seeing is the version of the CLR, the Common Language Runtime. Every .NET version since 4.0 runs on version 4.0.30319 of the CLR so it's normal to see that number even for a .NET 4.5.2 application.

    The version of the clr does change in between frameworks, it's just that the difference is further in the version number. For example .NET 4.0 runs on CLR 4.0.30319.0 to 4.0.30319.17000, .NET 4.5 runs on CLR 4.0.30319.17001 to 4.0.3019.18400, etc. (Source)