I'm attempting to use PowerBuilder.RegistedObject.TriggerEvent() method in C# and PowerBuilder 2022. I've tried to do it with the simplest of examples.
I don't have any issues registering the assembly, creating the object and calling methods from the C# object. I also am able to register and unregister the object without any issues. Any time I call the TriggerEvent method in C# though, I get the error -52 - The objectname is not registered.
I've checked and double-checked the object name for spelling errors, and I know it is case sensative (w_testing is what I'm using)
Any suggestions on how I can debug this? Is there a reason it is registered fine in PowerBuilder but not from my C# DLL. When I UnRegister, I don't get errors unless I do something like UnRegister twice, which seems to sort of confirm that the register/unregister is working. Is there somewhere I can look to "see" the registration? Is there a chance the C# DLL is looking in the wrong place for the registered object?
Thanks!
EDIT: I was able to redo my example with .NET Framework 4.8 and the appropriate invoker dll. It worked perfectly. I now suspect it has to do with me probably not having the correct DLLs available for the .NET6 C# DLL.
There is a slight issue with your registration code. Please change 'this' to 'parent' as follows:
st_2.text = string(ino_service.RegisterObject(parent.classname(),parent))
Additionally, ensure that there is no separate pbdotnetinvoker.dll file under the DLL and EXE directory. PowerBuilder will load the pbdotnetinvoker.dll from the Runtime directory and its associated DLLs.
Best Regards,
Peter