cancel
Showing results for 
Search instead for 
Did you mean: 

Using a .NET assembly in a PB Classic app with async invocations

former_member329524
Active Participant
0 Kudos

Hello, all

I have a large PB classic app, which needs to use a third party .NET assembly, which has wait/async commands in it.

Will it be even possible to use it in PB, since the UI thread would simply block it and I will never get a response?

Thank you

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

You might want to consider creating a COM wrapper for your .net assembly and then trigger a user event when your sync op is completed. You can then code this event in your Powerbuilder ole object. Make sure that this userevent is exposed. Many years ago I did something similar with MS Outlook - I needed to capture the Send event of a message.

I don't know if PB 2017 will let us consume .net assemblies directly without the need for COM wrappers. Chris P might have a definite answer.

former_member329524
Active Participant
0 Kudos

Thank you, Roland

If this is the only option, then it is not very useful. All the calls in the .NET code are "await", i.e., as far as the main flow is concerned they are synchronous. So, there is a flow, which produces result and I need to return them to the PB program. And using Sharedobjects is very problematic for this, because the result are not returned to the main thread.

I guess, I will have to create and launch a WinForm app to use this assembly.

Does anyone know if this issue can be handled differently in the upcoming PB 2017?

Former Member
0 Kudos

You could call it from a background thread (SharedObject functions).