Hey Govert,I don't think it's the extra copy issue. I actually added the ExcelDna.Integration project to my solution and set some breakpoints. Looks like this piece of code is throwing an exception when it tries to create an instance of my addin class:static public void GetExcelAddIns(ExportedAssembly assembly, Type t, bool loadRibbons, List<ExcelAddInInfo> addIns)
{
try
{
Type addInType = t.GetInterface("ExcelDna.Integration.IExcelAddIn");
bool isRibbon = (t.BaseType == typeof(ExcelRibbon));
if (addInType != null || (isRibbon && loadRibbons) )
{
ExcelAddInInfo info = new ExcelAddInInfo();
if (addInType != null)
{
info.AutoOpenMethod = addInType.GetMethod("AutoOpen");
info.AutoCloseMethod = addInType.GetMethod("AutoClose");
}
info.IsCustomUI = isRibbon;
info.Instance = Activator.CreateInstance(t);
info.ParentDnaLibrary = assembly.ParentDnaLibrary;
addIns.Add(info);
}
}
catch (Exception e) // I think only CreateInstance can throw an exception here...
{
Debug.Print("GetExcelAddIns CreateInstance problem for type: {0} - exception: {1}", t.FullName, e);
}
}Here's the exception detail:System.Reflection.TargetInvocationException was caught
HResult=-2146232828
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
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) in C:\code\ExcelDNA\Source\ExcelDna.Integration\AssemblyLoader.cs:line 159
InnerException: System.TypeInitializationException
HResult=-2146233036
Message=The type initializer for 'YChartsExcelAddin.YChartsMain' threw an exception.
Source=YChartsExcelAddin
TypeName=YChartsExcelAddin.YChartsMain
StackTrace:
at YChartsExcelAddin.YChartsMain..ctor()
InnerException: System.ArgumentException
HResult=-2147024809
Message=An item with the same key has already been added.
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at YChartsExcelAddin.YChartsMain..cctor() in C:\code\ycharts_excel\YChartsExcelAddin\YChartsExcelAddin\Class1.cs:line 119
InnerException:Do you think it's something in the constructor or static initializers for my class?Thanks,Farhan
----
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.
Farhan AhmedP: 425-802-3818
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.
FarhanI am just curious...How does "GetExcelAddIns" method gets invoked ?Thanks
Cheers.
To unsubscribe from this group, send email to exceldna+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.
--Farhan AhmedP: 425-802-3818
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To view this discussion on the web visit https://groups.google.com/d/msg/exceldna/-/XLJ7wXnIyFQJ.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.