.NET issue

I am trying to use my first .NET control. (I have used ActiveX controls many times.) When I run my program I get the following error:

"There was a problem with one of the .NET support libraries. .NET assemblies cannot be loaded." 

Here is the background:

I am using the 9.22 run-time and created my copy files with 9.22s NETDEFGEN.
My control comes in 2 .NET versions 3.5 and 4.0 I have tried both with the same result.
I have tried to install the control in the ACU dir with the wrun32 I am using and in a separate folder. (Uninstalling the control between installs.)
It is currently in a separate folder and I have created a netevents.ini with the path to the current install folder in my ACU folder.
My control does not show up in GAC but I browse to and everthing seems to go ok.
NETDEFGEN does not crate an events .dll that I can find but I don't think the control has any events.
I have tried the create statment with and without the event procedure.

My development machine is Windows 7 64 bit. The control is 32 bit. It comes in a 64 bit version but I believe I have to use the 32 bit for compatibility with Wrun32.

NETDEFGEN has created a copy file for the control and a NETObject.def copy file both of which I have under Special-Names in the Configuration Section.

I have the following in my working-storage:
77 CommSetting-HANDLE USAGE IS HANDLE.

I am using the following create statment:
CREATE "@PPPLink"
NAMESPACE IS "PPPLink"
CLASS-NAME IS "CommSetting"
EVENT PROCEDURE IS EVENT-PROC
HANDLE IS CommSetting-HANDLE.

Here is the assembly from the copy book:
OBJECT @ASSEMBLY
NAME "@PPPLink"
VERSION "1.0.5660.32482"
CULTURE "neutral"
STRONG "f3876d2f4d7rb819"

Here is the class from the copy file: 
* PPPLink.CommSetting
NAMESPACE "PPPLink"
CLASS "CommSetting"
MODULE "PPPLink.dll"

I have read through the .NET section of the interoperability guide and feel like I am doing what is required but am probably missing some thing.

Tags:

  • Can you confirm that you using the 32 bit runtime ... wrun32 -vv returns a dialog showing which bit it is.

  • I mistakenly said I have run both the 3.5 and 4.0 versions of the control with the same result. I just uninstalled the 4.0 version and tried to install the 3.5 version and NETDEFGEN gives the error:

    "Failed to extract classes. Mixed mode assembly is buitl against version V2.0.50727 of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

    So everthing I mentioned above was done with the 4.0 version of the control.

  • I mistakenly said I have run both the 3.5 and 4.0 versions of the control with the same result. I just uninstalled the 4.0 version and tried to install the 3.5 version and NETDEFGEN gives the error:

    "Failed to extract classes. Mixed mode assembly is buitl against version V2.0.50727 of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

    So everthing I mentioned above was done with the 4.0 version of the control.

  • Last line of the dialog is "Configuration: WIN32, IA-32"

  • I'd like to know if you have successfully run our .Net example .. C:\Program Files (x86)\Micro Focus\Acucbl922\AcuGT\sample\dotnet\NETOBJECTS .. if that works it would show you have a working configuration.

  • I had not, so I tried it this morning doing as little tweaking as possible. I used the .dlls and .def files supplied with the sample and compiled the program. When I run it I get the following error:

    "Missing .net 4.0 framework. .NET controls cannot be loaded. : 0xffffff9b"

    I downloaded 4.0 framework from Microsoft but when I attempted to install it I got the error that I had an equal or greater version already installed.

  • That is a strange message. The runtime loads the 4.0 CLR when executing .net assemblies. In particular,

    version 4.0.30319.  The AmortControl sample has been updated to be a 4.0 assembly so try that sample and see if an error occurs.

  • I tried the AmortControl sample and got the same message. Then I found the error of my ways, I was using samples from a 9.10 install with the 9.22 compiler/run-time. when I recompiled with the 9.10 compiler and used the 9.10 run-time I got much farther. The screen loaded and looked good but when I entered values and pressed "Calculate" I received the following error:

    ---------------------------

    Test .NET Amortization Control

    ---------------------------

    Retrieving the COM class factory for component with CLSID {EFEBAF2A-7183-4BE7-B0AA-7ECAD198414F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

    COBOL error at 0000A6 in H:\CBL800\AMORTCONTROL

    ---------------------------

    OK  

    ---------------------------

    Apparently you have to register a .NET control like an ActiveX but not with Regsvr32.

    I tried my control in the 9.10 environment with a similar result. I was able to create a class but got the class not registered error when I tried to modify it.

    Could it be that something is missing from my ACU922 folder. If so do you have any idea what it might be?

    Thanks for your help.

  • I tried the AmortControl sample and got the same message. Then I found the error of my ways, I was using samples from a 9.10 install with the 9.22 compiler/run-time. when I recompiled with the 9.10 compiler and used the 9.10 run-time I got much farther. The screen loaded and looked good but when I entered values and pressed "Calculate" I received the following error:

    ---------------------------

    Test .NET Amortization Control

    ---------------------------

    Retrieving the COM class factory for component with CLSID {EFEBAF2A-7183-4BE7-B0AA-7ECAD198414F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

    COBOL error at 0000A6 in H:\CBL800\AMORTCONTROL

    ---------------------------

    OK  

    ---------------------------

    Apparently you have to register a .NET control like an ActiveX but not with Regsvr32.

    I tried my control in the 9.10 environment with a similar result. I was able to create a class but got the class not registered error when I tried to modify it.

    Could it be that something is missing from my ACU922 folder. If so do you have any idea what it might be?

    Thanks for your help.

  • I googled the "80040154 Class not registered" error and and it seems this is a 32 bit control on a 64 bit OS issue. Here is an excerpt form a common answer:

    "One standard failure mode is running this on a 64-bit operating system. This is 32-bit unmanaged code, you would indeed get the 'class not registered' exception. Project Properties, Build tab, change Platform Target to x86."

    I don't have visual studio but I looked at the AmortControl.csproj in a text editor. (AmortControl.csproj is an xml file) I found several references to Platform set to AnyCPU which I think needs to be changed to x86 for a 32 bit control. I will try to get access to visual studion and try the change myself.