Skip to main content

[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.

[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.
As always, a small little example that illustrates your problem would be handy...

[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.
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.

[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.
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.

[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.
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.

[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.
Hi, Dilbert.

The use of a namespace makes no difference.

Thanks for reply.

[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.
I suggest you send the .net DLL and the example code to tech support, I cannot see anything here that makes a bell ring.

[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.
I suggest you send the .net DLL and the example code to tech support, I cannot see anything here that makes a bell ring.

[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.
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.

[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.
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.

[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.
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.

[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.
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.

[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.
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.