Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diagnostic display apear on open the add-in

We have the add-in to excel written in C#. We are using Excel-DNA also. Lately we got this window on startup of Add-in enter image description here

Any idea what is this window and how we can turn of it?

like image 445
Gadziu Avatar asked Dec 08 '25 09:12

Gadziu


2 Answers

By default, Excel-DNA will try to register all public static methods in public types in the assemblies listed as <ExternalLibrary ...> in the .dna file.

For your add-in, there seems to be more than one such function called 'Modulus' that Excel-DNA is trying to register. The error arises from this duplication (one registration is being overwritten by another).

You have a few ways around this:

  • Make sure you only have one 'Modulus' function being registered, either by making one of the methods not public, or enabling 'ExplictExports=true' in your .dna file and marking all functions with ExcelFunction attributes.
  • Make sure you don't have additional libraries set up as <ExternalLibrary> in the .dna file - extra assemblies that you want to pack into a single-file .xll should be added as <Reference> tags - these are not examined for functions and registered with Excel.
  • You can control how the logging works, and thus prevent the error window from showing, by customising the logging settings in the .xll.config file - see https://github.com/Excel-DNA/ExcelDna/wiki/Diagnostic-Logging.
like image 50
Govert Avatar answered Dec 10 '25 22:12

Govert


Answer from @Govert is helpful, but if you don't want to correct error and warnings in this window and not to see it you need to paste this part of code in your app.config file:

<!--Switch off the diagnostic -->
<system.diagnostics>
   <sources>
      <source name="ExcelDna.Integration" switchValue="Off"></source>
   </sources>
</system.diagnostics>
like image 36
Gadziu Avatar answered Dec 10 '25 22:12

Gadziu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!