Excel-DNA / ExcelDnaDoc

Command-line utility to create a compiled HTML Help Workshop file (.chm) for Excel-DNA
http://excel-dna.github.io/ExcelDnaDoc/
Other
33 stars 17 forks source link

Conflicts between ExcelFunction and ExcelFunctionDoc attribute #36

Open casbby opened 2 years ago

casbby commented 2 years ago

Hi

When I include both ExcelFunction and ExcelFunctionDoc function attributes the doc gen will fail

 Unhandled Exception: System.Reflection.AmbiguousMatchException: Multiple custom attributes of the same type found.
1>     at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
1>     at ExcelDnaDoc.Utility.ExcelDnaHelper.IsValidFunction(MethodInfo method, Boolean explicitExports)
1>     at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
1>     at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
1>     at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
1>     at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
1>     at System.Linq.GroupedEnumerable`3.GetEnumerator()
1>     at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
1>     at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
1>     at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
1>     at ExcelDna.Documentation.Models.AddInModel.<get_Functions>d__13.MoveNext()
1>     at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
1>     at CompiledRazorTemplates.Dynamic.aafaffbb.Execute()
1>     at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
1>     at RazorEngine.Razor.Parse[T](String razorTemplate, T model)
1>     at ExcelDnaDoc.Templates.ViewBase`1.Publish()
1>     at ExcelDnaDoc.HtmlHelp.Create(String dnaPath, String helpSubfolder, Boolean excludeHidden, Boolean skipCompile, Boolean runAsync)
1>     at ExcelDnaDoc.Program.Main(String[] args)

I can see ExplicitRegistration and SuppressOverwriteError have been included in both attributes therefore this error seems to be logical outcome.

Can you please confirm this is a bug and advise?

Thank you very much.

Casbby

govert commented 2 years ago

@casbby - I've made an update to the ExcelDnaDoc package on NuGet as v1.5.0-rc. This should now be compatible with ExcelDna v 1.5.0. Please let me know whether this works for you.