错误信息如下: 目前这个问题只有当我在X86机器上使用编译好并且GACUTIL 到assembly的DLL(该DLL 调用了PerformanceCounter)时才会出现,如果是在VS项目中DEBUG源文件,一切正常,并且在64位机器上该DLL 可以正常使用
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.Win32.Win32Native.RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName, Int32[] lpReserved, Int32& lpType, Byte[] lpData, Int32& lpcbData)
at Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object defaultValue, Boolean doNotExpand, Boolean checkSecurity)
at Microsoft.Win32.RegistryKey.GetValue(String name)
at System.Diagnostics.PerformanceMonitor.GetData(String item)
at System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item)
at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
at System.Diagnostics.PerformanceCounterLib.CounterExists(String category, String counter, Boolean& categoryExists)
at System.Diagnostics.PerformanceCounterLib.CounterExists(String machine, String category, String counter)
at System.Diagnostics.PerformanceCounter.InitializeImpl()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)