StackOverflow Exception When Creating new Excel.Application

Sep 16, 2014 at 8:56 PM
This is driving me crazy, not sure what I'm missing.

This line of code within an assembly I'm building (a plugin for Act!) causes Act! to crash and throws a StackOverflow exception when I attach to Act! to debug it.

Project is set for x86, .NET 4.0

I can do this no problem with a new Windows Form application, and a colleague has used NetOffice with Excel (same line of code) for another Act! plugin no problem.

Any ideas what I might be missing?

Thanks in advance!
Sep 25, 2014 at 10:46 PM
hey man!

I need some code(exception strack trace) to pin point the problem. (no reported bugs like this in NetOffice so far)

the common understanding problem is: you try to access the host application and start a new one.(check your taskmanager for excel.exe if the problem occours)

for my feel: its a plugin, right???

Another fast option is to send me your solution to public.sebastian[at] (Remove any other private code if you want) In this case i can reproduce the problem and give you an answer very feasy(fast and easy)

Sep 26, 2014 at 3:59 AM
It doesn't give me an exception stack trace, but here is the code I'm using, which is pretty basic:

NetOffice.ExcelApi.Application excelApp = new NetOffice.ExcelApi.Application();
NetOffice.ExcelApi.Workbook book;
NetOffice.ExcelApi.Worksheet sheet;

Strangely, this works fine on two different development machines my colleague uses, and on two of mine it exhibits this problem.

We ran it on another computer, and got yet a different message "Worksheet not found in loaded NetOffice Assemblies".

Any ideas?

Sep 27, 2014 at 7:05 AM
"Worksheet not found in loaded NetOffice Assemblies"
Sounds like a reference problem. NO cant' find the loaded ExcelApi.dll in the current AppDomain. I need to know your NetOffice version and operating system version to reproduce the problem. (op-system in test and failed prod system) BTW: make sure the solution is not loaded from a network ressource(forbidden in .NET default policies)

I see, your example code is not real, its impossible that Workbook works fine and Worksheet cause trouble. (BTW the compiler removes unused variables and the NO types are never adressed/analyzed/called. I need your (nearly)real scenario to find a solution for you. otherwise i only can point you the right direction (based on I/O prinicple)


Troubleshooting/Analyze Hint: Disable other extensions/addins on your problem-child system. This helps to identify the problem.
Sep 29, 2014 at 5:29 PM
Just sent the source to your address.

Will check the difference in specs between OS's and report back.

Thanks for your help thus far.