8
votes

I have a ASP.NET website using C# that calls a C++ method using DLLImport. Everything was working fine and suddenly I keep getting this error:

External component has thrown an exception. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.SEHException: External component has thrown an exception.

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

1
Can you post a full stack trace? Is there anything in the Event Viewer related to this error? - rsbarro
stack trace just points to the C# method that is calling the C++ method. do you think it could be because the C++ dll is cached and I have to clean asp.net temporary files? - InfoLearner
Maybe, especially if nothing else has changed on the server. I'm guessing you tried an iisreset or at least recycling the app pool? - rsbarro
Is there an inner exception that gives more detailed information? - Nathanael
it disappears everytime I do IISRESET and reappears when I run the method the second time. Seems like it's cached. What can be done to avoid this problem? - InfoLearner

1 Answers

2
votes

Obviously, exception is originating somewhere in C++ code. See this to understand SEHException. You can use ErrorCode property to get the actual error. If its a common HRESULT code, you can get details by searching over internet, if its some custom code then you probably had to contact C++ component author for more details.