You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@heckl This hasn't been investigated yet so there isn't any action at present. The description indicates that we need to look into it and once we have an understanding we will be able to define next steps.
Hello guys!
I did take a look at this but I wasn't able to get as far to a solution, but I did find a few things:
This also happens when using other classes from System.Collections.Generic namespace, e.g. Queue<T>, HashSet<T>, LinkedList<T>, SortedSet<T> and Stack<T>. More importantly, I did find that it also happens if you declare a new class, say TestT<T> internally and use it to return the value;
This doesn't happen when using an interface as the return type, so if you put IList<T> as return type and do return new List<T> it works perfectly. Same thing with the internal class I mentioned above, if we declare an interface ITestT<T> and use it, it doesn't crash;
This only occurs when dealing with an external library, like when having multiple projects as the issue states, and not if the method is internal to the binary;
This does not occur if you use reflection to call the method, the following also works as expected: typeof(TestClass).GetMethod("Test1No", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Invoke(null, new object[] { null });.
I also was able to find this stack trace with Windbg:
Activity
heckl commentedon Jan 3, 2024
Hi, I see the issue is added to the 9.0.0 milestone. Do you know a workaround so on .net 8?
AaronRobinsonMSFT commentedon Jan 3, 2024
@heckl This hasn't been investigated yet so there isn't any action at present. The description indicates that we need to look into it and once we have an understanding we will be able to define next steps.
ivanch commentedon Jan 3, 2024
Hello guys!
I did take a look at this but I wasn't able to get as far to a solution, but I did find a few things:
System.Collections.Genericnamespace, e.g.Queue<T>,HashSet<T>,LinkedList<T>,SortedSet<T>andStack<T>. More importantly, I did find that it also happens if you declare a new class, sayTestT<T>internally and use it to return the value;IList<T>as return type and doreturn new List<T>it works perfectly. Same thing with the internal class I mentioned above, if we declare an interfaceITestT<T>and use it, it doesn't crash;typeof(TestClass).GetMethod("Test1No", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Invoke(null, new object[] { null });.I also was able to find this stack trace with Windbg:
Hope this helps a little.
tombycz commentedon Jan 31, 2024
Hello,
this is probably caused by any use of generics in the output, I encountered the same issue with the method
int? GetNumber(Worksheet sheet, string rangeName)elinor-fung commentedon Mar 13, 2024
The fix for this is in the 8.0.3 release (and main). Thanks all for the report, repro, and investigation!