0

I am getting what seem like random SEHExceptions when debugging my MVC website. I think it is something to do with my local machine as it works fine on the server.

System.Runtime.InteropServices.SEHException occurred
  HResult=0x80004005
  Message=External component has thrown an exception.
  Source=mscorlib
  StackTrace:
   at Microsoft.Win32.Win32Native.CloseHandle(IntPtr handle)
   at Microsoft.Win32.SafeHandles.SafeWaitHandle.ReleaseHandle()
   at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
   at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
   at System.Runtime.InteropServices.SafeHandle.Finalize()

The above is all I get out of Visual Studio (2017) and when the exception is thrown, it then crashes localhost and I have to start again. Sometimes I manage to test what I'm trying to test and other times I get the exception.

Here's what I see in Visual Studio when it occurs: SEHException Visual Studio 2017

FYI - I already saw the suggestions to uninstall any Trusteer products, I don't have any such applications installed.

EDIT: Also, I've just noticed that this does not occur when I right click a MVC view and choose 'View in browser'. It only seems to occur when I try to run the whole project by pressing the start debugging button (with the play arrow).

EDIT: Here's the error event I found in the Windows Event Viewer tool: enter image description here

Andy Furniss
  • 3,814
  • 6
  • 31
  • 56
  • Related: https://stackoverflow.com/questions/1313853/how-should-you-diagnose-the-error-sehexception-external-component-has-thrown-a. Include part of code which suspected throwing exception. – Tetsuya Yamamoto Jul 13 '17 at 09:02
  • @TetsuyaYamamoto It doesn't happen at any specific piece of code. None of my code is in the stack trace. It just happens randomly when I'm trying to debug the website. I've edited the question with what I see when it occurs in Visual Studio. – Andy Furniss Jul 13 '17 at 09:09
  • I see this problem may occurred outside any managed code you have. To gather more information I suggest you using Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx). Another hint: 0x80004005 is known as `E_FAIL` flag, it may caused by `CloseHandle` method that receives invalid handle from `Finalize` (quite unexpected). – Tetsuya Yamamoto Jul 13 '17 at 09:17
  • Happy to give it a try. What is it I'm looking for? There's a huge amount going on in Procmon! – Andy Furniss Jul 13 '17 at 09:31
  • Since the exception occur in mscorlib.dll, try keeping an eye for `w3wp.exe`, `aspnet_wp.exe` & other related .NET worker processes. From event log you have, it is likely an IIS crash occurs when debugging - also check IIS event log & ensure there is no another application that possibly intervening worker processes. – Tetsuya Yamamoto Jul 13 '17 at 09:41
  • This is all I can find of any relevance: https://ibb.co/h4dKUa – Andy Furniss Jul 13 '17 at 10:28
  • have you tried opening the Exception settings window in visual studio and click the 'restore to default' button. – Ali Ashraf Jul 13 '17 at 11:29
  • Yeah, I even fully reset Visual Studio by doing a full repair. – Andy Furniss Jul 13 '17 at 11:36

0 Answers0