CREATE USING syntax in a .NET Assembly


Hi Everyone,

I'm working on migrating our PB 10.5 COM Object to a PB2017 .Net Assembly but I've had a problem with objects that are dynamically created with the "objectvariable = CREATE USING objecttypestring" syntax.  It can't seem to find the objecttypestring and returns a null object.  Is this syntax supported for .Net Assembly targets?

For example, the following type of code won't work (not real code obviously):


string ls_type = 'n_svc_string'
userobject lnv_object

lnv_object= create using ls_type


but this code will work:


string ls_type = 'n_svc_string'
userobject lnv_object

choose case ls_type
    case 'n_svc_string'
        lnv_object= create n_svc_string
    case 'n_svc_something_else'
        lnv_object= create n_svc_something_else
end choose


Does anyone know if the "create using" syntax is supported when deploying to a .Net assembly?


Question Tags: 


Miguel Leeuwe answered CREATE USING syntax in a .NET Assembly


The second way probably works, because you have a "Fixed" reference to you object, which is then detected and compiled.

If you only have a reference to the object as the contents of a string variable, the compiler doesn't pick it up.

You have to declare it somewhere as a variable or put the reference in a .PBR file.

HIH's picture

Thanks Miguel, I thought it might be something similar so I added a variable of the various types and I even added them as NVOs to the object just so the reference was baked in but I still couldn't get the "create using" syntax to work.  I think I can just work around it for now using the static object reference.

Miguel Leeuwe's picture

Okay, but sounds like a bug to me then.