1. ATK Gimmy Susan
  2. Beta Testing
  3. Monday, 25 November 2019 00:17 AM UTC

 

I try to use the new C# Class Importer, which allows PowerBuilder to use .NET assemblies directly without having to first create a COM Callable Wrapper for them.

 

i have this error:

 

some ideas ?

 

Thanks

 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 25 November 2019 04:18 AM UTC
  2. Beta Testing
  3. # Permalink

Just ideas:

1) compile with a different version of .net: try 4.5.1 or 4.7.x (.net core?)

In the help file, "about c# assembly", you'll find this information: 

The C# assembly supported by PowerBuilder must be developed on .NET Framework 4.0 or later or .NET Standard 1.0 or later. And the assembly DLL file will require the corresponding version of .NET Framework to run, especially if the DLL file is a .NET Standard class library. Please check the Microsoft website or the following table for the compatible versions between .NET Standard and .NET Framework.

 

.NET Standard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0
.NET Framework 4.5 4.5 4.5.1 4.6 4.6.1 4.7.2 4.7.2 4.7.2

 4.0 is missing in this table. Also I've tried 4.7.1 and that worked. I find the whole compatibility thing quite confusing to be honest.

2) in the assembly, do not mark the dll as COM visible. I only did a small test so far and did not mark the DLL as com visible and it worked. I'm not sure if that's important though.

- that's all I can think of

 

Comment
There are no comments made yet.
Richard Keller Accepted Answer Pending Moderation
  1. Wednesday, 11 March 2020 22:46 PM UTC
  2. Beta Testing
  3. # 1

If you are using Nuget Packages the C# Importer Cannot find them. So be aware of that.   You can copy the nuget library to a publish directory to bypass.     Also, it looks like it only support primitives right now, so any complex C# classes in the methods or return values doesn't seem to be supported.    Can anyone else confirm that?

Comment
  1. Michael Kramer
  2. Thursday, 12 March 2020 00:57 AM UTC
True, simple C#/.NET data types. There are also extra restrictions on how you may use datetime values. I serialized complex C# data structure into JSON = string. Then I had to mimic similar structure in PB or navigate the JSON document directly.

My experience: C# Class Importers needs direct reference to the .DLL.
  1. Helpful
  1. Mark Lee @Appeon
  2. Thursday, 12 March 2020 02:31 AM UTC
Hi Richard,



Michael Kramer is right. You can refer to the following link for more details:

https://docs.appeon.com/appeon_online_help/pb2019r2/application_techniques/ch20s01.html#d0e14827



Regards,

  1. Helpful
There are no comments made yet.
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 26 November 2019 09:36 AM UTC
  2. Beta Testing
  3. # 2

Hi ATK,

I suggest you verify Miguel's suggestion and see if it works for you.

If not, I also suggest you report this issue to our support ticketing system :https://www.appeon.com/standardsupport/newbug

and provide a sample test case for us to reproduce it.

Just ideas:

1) compile with a different version of .net: try 4.5.1 or 4.7.x (.net core?)

In the help file, "about c# assembly", you'll find this information: 

The C# assembly supported by PowerBuilder must be developed on .NET Framework 4.0 or later or .NET Standard 1.0 or later. And the assembly DLL file will require the corresponding version of .NET Framework to run, especially if the DLL file is a .NET Standard class library. Please check the Microsoft website or the following table for the compatible versions between .NET Standard and .NET Framework.

 

.NET Standard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0
.NET Framework 4.5 4.5 4.5.1 4.6 4.6.1 4.7.2 4.7.2 4.7.2

 4.0 is missing in this table. Also I've tried 4.7.1 and that worked. I find the whole compatibility thing quite confusing to be honest.

2) in the assembly, do not mark the dll as COM visible. I only did a small test so far and did not mark the DLL as com visible and it worked. I'm not sure if that's important though.

- that's all I can think of

 

 

Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Monday, 25 November 2019 07:13 AM UTC
  2. Beta Testing
  3. # 3

Most of my testing I've done using .NET Standard 2.0.

I suggest compiling for .NET Standard when possible since that allows your assembly to run on both .NET Framework and .NET Core.

Comment
  1. Miguel Leeuwe
  2. Monday, 25 November 2019 12:19 PM UTC
Thanks for the tip!
  1. Helpful
  1. Michael Kramer
  2. Monday, 25 November 2019 13:03 PM UTC
.NET Standard 2.0 covers a much wider API surface than 1.0 and 1.5. - and SnapDevelop supports .NET Standard 2.0 so you can use Visual Studio, VS Code, and SnapDevelop on same solution + projects back and forth as you like. Quite convenient.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.