Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jun 15, 2017 at 01:47 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 18, 2017 at 06:25 AM

    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?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 19, 2017 at 04:15 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded