Excel dna plugin not working with Excel 2013

308 views
Skip to first unread message

saurabh vats

unread,
Jul 18, 2016, 3:20:23 AM7/18/16
to Excel-DNA
Hi Govert,

we tested our xll plugin with Excel 2010 and it's working fine, Now when we are trying to use the same plugin with Excel 2013 its giving us below exception, I have attached two pics one with Excel 2010(when its correctly loaded and second with Excel 2013 where its giving exception:

Initialization [Warning] GetExcelAddIns CreateInstance problem for type: SaxoExcelTrader.Application.CTP.ExcelTraderRibbon - exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

   at ‪​​‏‏‍‫‫‫‍‌()

   at .cctor()

   --- End of inner exception stack trace ---

   at SaxoExcelTrader.Application.DIEngine.Register()

   at SaxoExcelTrader.Application.Bootstrap.Init()

   --- End of inner exception stack trace ---

   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)

   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

   at System.Activator.CreateInstance(Type type, Boolean nonPublic)

   at System.Activator.CreateInstance(Type type)

   at ExcelDna.Integration.AssemblyLoader.GetExcelAddIns(ExportedAssembly assembly, Type t, Boolean loadRibbons, List`1 addIns)

Initialization [Error] DnaLibrary AutoOpen Error : TargetInvocationException - Exception has been thrown by the target of an invocation.


Please could you help with the above error.


Thanks,

Saurabh

pic1.png
pic2.png

Govert van Drimmelen

unread,
Jul 18, 2016, 4:27:14 AM7/18/16
to exce...@googlegroups.com

Hi Saurabh,

 

This sounds like something specific to your add-in and its dependencies.

 

You might need to start from a very simple version that works under Excel 2013, and then add back features and dependencies until you track down the source of the problem.

 

It doesn’t sound like a general Excel-DNA issue.

 

-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 https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

saurabh vats

unread,
Jul 18, 2016, 4:34:36 AM7/18/16
to Excel-DNA
Hi Govert,

I investigated this further and the issue is coming in the below code(Xlcall is throwing exception):

    public class ExcelAddIn : IExcelAddIn
    {
        private readonly string _pluginPath;

        public ExcelAddIn()
        {
          
            PluginPath = (string)XlCall.Excel(XlCall.xlGetName);

Govert van Drimmelen

unread,
Jul 18, 2016, 4:39:45 AM7/18/16
to exce...@googlegroups.com

It might be better to do that call, and similar initialization, in the IExcelAddIn.AutoOpen().

 

It’s less predictable where the class gets constructed, and might not be in a context where the C API will work.

Reply all
Reply to author
Forward
0 new messages