Getting “Nil Object Exception” while calling C# DLL method from XOJO

Hello Everyone,

I am trying to access C# method by using C# DLL from XOJO Tool.

I have follow the procedure Jim have define in the following post:

https://forum.xojo.com/7079-using-c-classes-in-xojo

and everything is configure correctly but when i execute the program, it gives me error NilObjectException was not handled, even when i am passing proper parameter.

Below is the C# code:

using System.Windows.Forms; using System.Runtime.InteropServices; namespace XojoStuff { [Guid("DB038D2E-BD4D-44A7-BE64-4844FF07F870")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IManagedInterface {[DispId(1)] int PrintHi(string name); } [Guid("AB46D07F-6920-4114-924B-5E37BED3A65E")] [ClassInterface(ClassInterfaceType.None)] public class InterfaceImplementation : IManagedInterface { public int PrintHi(string name) { MessageBox.Show(name); return 1; } } }
Below is the calling from Xojo:

dim o as New XOJOCSDLL.InterfaceImplementation Call o.PrintHi("Hello")

It should show message box when the execution file is run with the message of Hello

If you run in the debugger, is “c” nil?

@Greg O’Lone
No “o” is not Nil, it consist of “XOJOCSDLL.InterfaceImplementation”, class definition