0

I have a problem with my VSTO add in. On some random machines I recieve an AccessViolationException trying to use PropertyAccessor.GetProperty.

I couldn't find an explenation on the internet for why this exception accures.

Also it seems there is no way to catch this exception, i use a try catch block that catces (System.Exception), but it doesn't catch it and outlook crashes.

Any ideas on what can be the problem?

Chuk Pat
  • 1
  • 1
  • 2

1 Answers1

0

Decorate your method with the attribute [HandleProcessCorruptedStateExceptions]:

[HandleProcessCorruptedStateExceptions]
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
  try
  {
    //Do something...
  }
  catch (Exception ex)
  {
    //This is catching ALL exception types 
    //even AccessViolationException
    //or OutOfMemoryException
  }
}
jreichert
  • 1,466
  • 17
  • 31