Debugging excel-dna addin

466 views
Skip to first unread message

Gilles

unread,
Nov 20, 2013, 11:29:15 AM11/20/13
to exce...@googlegroups.com
Hi,

I'm new to ExcelDNA and I'm stuck with a (hopefully simple) debugging issue where Excel exits abnormally.

I'm running VS2012 express, and my addin code is included below.. I launch Excel manually, load the add-in, attach the debugger to Excel in VS. I then setup a breakpoint on the return statement. When I use the function in Excel, I hit the breakpoint correctly, but when I choose to Continue, Excel exits with error code:

"The program '[2680] EXCEL.EXE: Managed (v4.0.30319)' has exited with code -1073740791 (0xc0000409)"

Any help would be greatly appreciated.

thanks
Gilles

using System;
using ExcelDna.Integration;

namespace TestXlAddin
{
    public class Class1
    {
        [ExcelFunction(Description = "My first Excel-DNA function")]
        public static string MyFirstFunction(string name)
        {
            return "Hello " + name;
        }
    }
}

Govert van Drimmelen

unread,
Nov 24, 2013, 1:51:47 PM11/24/13
to exce...@googlegroups.com
Hi Gilles,

This is an unusual error that I've not had reported before. The only thing I can think of is the debugging engine being used by Visual Studio is more that just the managed debugger.

I suggest you try this:
* Start Excel outside the debugger.
* Select Debug->Attch to Process
* Now click on the Excel.exe process in the list, and then click on the Select button next to the Attach to: options.
* Select only the Managed (v4.5, v.4.0) option here.
* Click OK, and then Attach.

If this does not work, we might have to investigate further.

Regards,
Govert

saurabh vats

unread,
Jun 12, 2015, 8:21:28 AM6/12/15
to exce...@googlegroups.com
Hi Govert,

I am getting the same issue , I am trying to debug my application using following steps

a. I opened up my xll file 
b. Go to attach process option and then I selected Excel
c. on clicking Ribbon Button its hitting the breakpoint but its exiting the code on pressing F10 or F11

Error shown in the Output window is 
The program '[45668] EXCEL.EXE' has exited with code -1073740791 (0xc0000409).

Please could you help 

Thanks
Saurabh

Govert van Drimmelen

unread,
Jun 12, 2015, 8:31:16 AM6/12/15
to exce...@googlegroups.com

Hi Saurabh,

 

Does Excel keep running when you don’t attach the debugger?

Can you add an exception handler around your ribbon callback? Unhandled exceptions in ribbon callbacks will exit Excel.

 

-Govert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

saurabh vats

unread,
Jun 12, 2015, 9:10:45 AM6/12/15
to exce...@googlegroups.com
Hi Govert,

Thanks for your quick reply!

I think I got the issue after going through Event viewer on my machine, basically Event viewer shows that EMET is closing the process.
It seems I have to take permissions from ITBS team for removing checks on Excel.exe. what do you suggest?



Thanks,
Saurabh

Govert van Drimmelen

unread,
Jun 12, 2015, 9:15:46 AM6/12/15
to exce...@googlegroups.com

See https://groups.google.com/forum/#!msg/exceldna/RvhghtD3f9Q/rQsmObPfz94J

 

I think you have to configure EMET to allow you to debug Excel.

Message has been deleted

saurabh vats

unread,
Jun 12, 2015, 2:24:41 PM6/12/15
to exce...@googlegroups.com
Thanks Govert, yes I saw that thread unfortunately I dont have access for configuring this so will talk to our IT Support to configure this for me.

Many thanks for your help
Reply all
Reply to author
Forward
0 new messages