Skip to content

Command registration regression in v1.9.0 #809

@ittegrat

Description

@ittegrat

Take the following code:

<?xml version="1.0" encoding="utf-8"?>
<DnaLibrary Name="QuickTest" Description="ExcelDna Quick Test" Language="C#" RuntimeVersion="v4.0">
  <![CDATA[

    using ExcelDna.Integration;

    public static class Macros {

      public static void Macro1() {
        XlCall.Excel(XlCall.xlcAlert, "XLL Message 1", 2);
      }

      [ExcelCommand(MenuName = "Macros", MenuText = "Message")]
      public static void Macro2() {
        XlCall.Excel(XlCall.xlcAlert, "XLL Message 2", 2);
      }

    }

  ]]>
</DnaLibrary>

In version 1.8.0, both Macro1 and Macro2 are registered as type 2 macros.
In version 1.9.0 only Macro2 is registered as type 2 and Macro1 is registered as a type 1 function.

Maybe I'm wrong, but it seems to me that the problem lies in the IsCommand method used here DnaLibrary::AutoOpen(): only MethodInfos marked with the custom ExcelCommand attribute are filtered and registered as type 2 functions (Macro2), while Macro1 is considered as a normal function.

If I'm not wrong, in previous versions the IsCommand filter was deferred to the XlMethodInfo constructor.

Would it be possible to update the ExcelCommandRegistration::IsCommand() to take into account also MethodInfos with a void return type ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions