Skip to content

MethodNotFoundException in net8 #96268

Closed
@heckl

Description

@heckl

Description

public static List<int> Test1No(Worksheet sourceSheet) 
{
    return new List<int>();
}
public static int Test2Yes(Worksheet sourceSheet) 
{
    return 3;
}
public static List<int> Test3Yes() 
{
    return new List<int>();
} 

MethodNotFoundException occurs if there is a Worksheet (office.interop) parameter and a List return value. So version 2 and 3 works but not version 1. These methods are called from sperate project but both projects were .net 8. My workaround was going back to .net7.

Reproduction Steps

https://www.dropbox.com/scl/fi/mf20wxeqju9ghhm34z4td/TestSolution.zip?rlkey=8et27m0vgb6v2kpjg3j7ach84&dl=0

I created a solution to demonstrate the problem. You can build the solution but you will get the exception in runtime.

Expected behavior

There should be no exception at runtime.

Actual behavior

There is a MethodNotFoundException in runtime.

Regression?

If you go back to .net7 it works fine.

Known Workarounds

Go back .net7

Configuration

.net8
Windows 10
x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions