I have a C# assembly that is calling a PowerBuilder.NET(12.1 Build 7217) assembly. The PowerBuilder source code is contained below, you can see it is a rather simple true/false evaluation of a string.
When the PB.NET assembly is called by a Window in C#, it returns the expected result of "true". When the same code is called by a C# assembly, the code returns "", or an empty string.
I have managed to narrow the problem down to the DataStore interactions in the PB.NET assembly. If the PB.NET assembly is called from another assembly, the DataStore always has 0 rows and contains only empty strings. Has anyone seen or dealt with this before?
// Create instance of Datastore
ldsExpression = CREATE DataStore
// Set data object
ldsExpression.DataObject = "d_condition_expression"
//// Setting datawindow expression
lsExpression = 'condition_expression.expression = ~"' + asConditionExpression + '~"'
//// Apply Expression
lsError = ldsExpression.Modify(lsExpression)
IF len(lsError) = 0 THEN
ldsExpression.InsertRow(0)
//get the result
lsResult = ldsExpression.GetItemString(1,"condition_expression")
ELSE
lsResult = lsError
END IF
// Destroy instance of ldsExpression
DESTROY(ldsExpression)
RETURN lsResult
I see you are dynamically assigning a dataobject and I wonder if it is being included in the final assembly-- this is just a guess. This is similar to the problem that used to occur in a standard PB program when compiling to PBD's but not adding dynamically assigned dataobjects in the PBR file.
Another thing that I'd look at is 'use dot net nullable types" setting in .NET Assembly Target Properties-- another guess. Here is the documentation from Sybase.
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.help.pb.12.5/title.htm
I think it has something to do with the dataobject not being built into the assembly as you describe it as never having any rows.