Skip to content

ExcelHandle does not work with params object[] #852

Description

@awakesay

Description

Using params object[] together with [return: ExcelHandle] causes Excel-DNA startup to fail.

This minimal example reproduces the issue:

using ExcelDna.Integration;

public static class TestFunctions
{
    [return: ExcelHandle]
    [ExcelFunction]
    public static object CreateHandle(
        object value,
        params object[] values
    )
    {
        return new object();
    }
}

Excel-DNA throws the following exception during initialization:

Initialization [Error] Integration.DnaLibraryAutoOpen Error :
NotSupportedException -
A non-collectible assembly may not reference a collectible assembly.

Removing params fixes the issue:

using ExcelDna.Integration;

public static class TestFunctions
{
    [return: ExcelHandle]
    [ExcelFunction]
    public static object CreateHandle(
        object value,
        object values
    )
    {
        return new object();
    }
}

Environment

  • Excel-DNA: 1.10.0-preview4
  • .NET: net8.0-windows
  • Excel: Microsoft 365
  • Platform: x64
  • OS: Windows 11

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions