SEHException on VS2010 (and later), but only on .NET4 or later on Windows 7

My company finally upgraded our development team from 64-bit computers from Windows XP to Windows 7, and I just discovered a strange error with existing code in the new environment. This project refers to the COM library, which is used to interact with our document image management system. Any attempt to initialize an instance of this API library class now throws a SEHException. The returned error code was not informative. Here is the complete exception to the truncated example project that I wrote to test this problem:

System.Runtime.InteropServices.SEHException was caught
  ErrorCode=-2147467259
  HResult=-2147467259
  Message=External component has thrown an exception.
  Source=FileNetTestLib
  StackTrace:
       at FileNetTestLib.Library.Logon() in C:\Projects\Tests\SEHException\FileNetTestLib\Library.vb:line 4
       at SEHException.Form1.btnLogIn_Click(Object sender, EventArgs e) in C:\Projects\Tests\SEHException\SEHException\Form1.vb:line 7
  InnerException: 

While working with my model project, I was able to confirm the following:

  • An exception occurs only during debugging; running without debugging does not raise any exceptions.
  • Windows XP ( Win7 XP)
  • , - , .NET 4. .NET4 .

, , , Windows 7 .NET4 . , - .

, .NET4 , , . , , , , SEHExceptions , -, , , (1) SEHException try... catch, .NET ( ), .NET , ( , ) (2) Windows 7, , , .NET4 Win7.

FYI, 32- Win7, , Win7 64-bit Win7 . AM x86, x64 - COM-. VS 2013, VS 2010 .

, , ( , , , ), SEHExeption ( " | " ). "" VS ", AppDomain / " . .

COM- (ImageMagick, ), , COM, . COM-, , , - - COM-, , .

+4

Source: https://habr.com/ru/post/1530440/


All Articles