我正在调试 C# 应用程序崩溃。崩溃是在调用外部本机 DLL 时发生的。
Windows 事件日志包含以下报告。我的目标是.NET 4.5(在 Visual Studio 中)并且目标 PC 具有.NET 4.5.2。
我的问题是:为什么框架版本显示v4.0.30319?在我看来,应用程序运行在错误的 .NET 框架下。
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()
Run Code Online (Sandbox Code Playgroud)
我已确认使用 Raymondcc .NET 检测器实用程序安装了 4.5.2: https://www.raymond.cc/blog/how-to-check-what-version-of-microsoft-net-framework-is-安装在计算机中/
令人惊讶的是,.NET 检测器表明 4.0 甚至没有安装;它显示已安装的 …