Highlighted
Absent Member.
Absent Member.
772 views

[archive] NETDEFGEN & Visual Studio 2005

[Migrated content. Thread originally posted on 02 December 2005]

We are dealing with a strange behaviour using the NETDEFGEN utility to generate DEF files for Assemblies created in VB.NET 2005.

We receive most of times "The format of the 'Class.dll' file is not valid" message. But, and it is curious, the assembly works fine from AcuGT (creating the DEF from scratch).

We are using AcuGT 7.0.0, .NET Framework 2.0 (final) an Visual Studio 2005.

Is NETDEFGEN 7.0.0 not compatible with DotNetFx 2.0/VS2005 ?

Regards.

P.D. We have a number of other issues but this is the most important at this time.
0 Likes
9 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

As always, a small little example that illustrates your problem would be handy...
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

Well, we have a very simple VB.NET class:

Public Class MyClass

    Private msMyProperty As String

    ' Ejemplo de Constructor
    Public Sub New()
        MsgBox("Constructor Invoked")
    End Sub

    ' Ejemplo de Metodo
    Public Shared Sub MyMethod()
        MsgBox("Method Invoked")
    End Sub

    ' Ejemplo de Propiedad
    Public Property MyProperty() As String
        Get
            Return msMyProperty
        End Get
        Set(ByVal value As String)
            msMyProperty = value
        End Set
    End Property

    Protected Overrides Sub Finalize()
        MyBase.Finalize()
    End Sub

End Class


We build the assembly in Visual Studio 2005 (.NET Framework 2.0) successfully, but, when using NETDEFGEN to generate the Def copy file, we obtain a "The format of the 'Class.dll' file is invalid".

After trying in several machines the most shows the message described above, but in one or two cases NETDEFGEN generated the copyfile. The same .dll was always used. We can't isolate the reason of the failure. In fact one of that machines now generates the same error.

When generated the copyfile looks like:

      * .NET Copy Book - Generated On 02/12/2005 4:51:17

           OBJECT @ASSEMBLY
           NAME "@MyClass"
                  VERSION "7.0.1.0"
                  CULTURE "neutral"
                  STRONG "2ed42a3f46c18f5a"


      * FULLY-QUALIFIED-NAME Adds.Clases.MyClass, MyClass,
         version=7.0.1.0, Culture=neutral,
         PublicKeyToken=2ed42a3f46c18f5a

      * Adds.Clases.Clase
           NAMESPACE "Adds.Clases"
           CLASS "MyClass"
           MODULE "Clase.dll"


                CONSTRUCTOR,  0, @CONSTRUCTOR1

      * Void MyMethod()
                METHOD,  0, "@MyMethod"

      * System.String get_MyProperty()
                METHOD,  0, "@get_MyProperty"
                           RETURNING "BSTR", TYPE 8

      * Void set_MyProperty(System.String)
                METHOD,  0, "@set_MyProperty"
                         "BSTR" @value, TYPE 8

      * Void Finalize()
                METHOD,  0, "@Finalize"

      * Public - fields


      * MyProperty
                PROPERTY_GET, 0, @MyProperty
                         RETURNING, "BSTR", TYPE 8

      * MyProperty
                PROPERTY_PUT, 0, @MyProperty
                        "BSTR (Property Value)", TYPE 8


We have started to try generating the assembly under Visual Studio 2003 (.NET Framework 1.1) and looks it works fine. We have to do additional testing.

Note that the main problem is the use of NETDEFGEN, because the assembly works well in the following sample:

           CREATE "@MyClass"
                  NAMESPACE IS "Adds.Clases"
                  CLASS-NAME IS "MyClass"
                  HANDLE H-NET.

           MODIFY H-NET "@MyMethod"().

           MODIFY H-NET @MyProperty = "Hello, NET".
           INQUIRE H-NET @Property IN W-RESPONSE.

           DISPLAY MESSAGE BOX W-RESPONSE.


It works even in the machines that NETDEFGEN do not.

If someone needs more info, please let me know.

Best Regards.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

I noticed that your example did not include a namespace. You might want to load the AmortControl sample that Acucorp provides and look at the AmortControl.cs code. That might provide some insight as to what needs to be added to your example.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

Hi, Dilbert.

The use of a namespace makes no difference.

Thanks for reply.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

I suggest you send the .net DLL and the example code to tech support, I cannot see anything here that makes a bell ring.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

Tech support confirms problems with .NET Framework 2.0 due to changes introduced by Microsoft.

?.NET Framework 2.0 will not allow VT_INT types to be marshaled as an IntPtr using COM Invoke calls from the runtime.
Also it will not allow VT_INT_PTR to be marshaled as an IntPtr.?


This requires changes from Acucorp which are scheduled for the upcoming versi?n 8.0.0.

Tech support advise to use version 1.1 of .NET framework until then.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

Well, going on...

I'm using now, as Acucorp recommends, the version 1.1 of .NET Framework.

Following the posted sample I get a invalid class string error when invoking "MyProperty" Property.

Note that the previously invoked method "MyMethod" works fine.

Any idea ?

P.D. The NetDB samble provided with AcuGT 7.0 shows the same behavior.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

I reply myself:

I get this message only on one of my development machines, so this is not, fortunately, related to AcuGT itself.

However, i can't find clear information about this error. Has anybody seen this issue before ?

Regards.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] NETDEFGEN & Visual Studio 2005

I believe that there are registry entries that are meade when you install ACUCOBOL-GT and .Net. You might consider reinstalling (now that you've changed the .Net framework) and see if this clears up this issue.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.