This was an issue with Mono prior to version 2.6. The fix addresses pass by ref to CreateInstance.
mono - how to use ref with CreateInstance or InvokeMethod?
-
10-03-2022 - |
Domanda
How do I pass by 'ref' using CreateInstance in Mono?
Example:
public MyMethod(ref SomeType data) {...
...
SomeType st = new SomeType();
object handle = Activator.CreateInstance(type, new object[] { st });
This works fine in my windows console application. The problem is when I port this to Mono, I get a missing method exception stating that no 'MyMethod' was found that accepts the type 'SomeType'.
If I remove 'ref' from the constructor Mono finds the method and runs it without any issue.
Any ideas?
Thanks in advance.
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow