Search code examples
c#excelexcel-dna

Debuging .xll in Visual Studio kills attached Excel session


hopefully someone had the similar issue and will be able to help... Visual Studio 2010

I have an xll file that is created using excel-DNA and C#. I'm able to attach it to excel spreadsheet with my xll loaded in and hit the break point in visual studio 2010 project when I use the method in the excel sheet. I also can see all passed in arguments with all the correct values. But as soon as I click step into to start debugging the code it crushes my excel. I also tried simply put second break point and execute code to go forward but it also crush excel. Have no idea what to try. All suggestions are welcome.


Solution

  • Your problem might be caused by a Microsoft tool called the "Enhanced Mitigation Experience Toolkit" (EMET). By default, it prevents debugging of Excel. You can check the Event Log for events that say something like: "EMET detected EAF mitigation and will close the application: EXCEL.EXE".

    There is an EMET GUI tool that allows you to change the settings for Excel.

    If not EMET, the problem might be caused by some similar security utility on that computer.