Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
SteveEly Absent Member.
Absent Member.
4587 views

.NET issue

Jump to solution

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 (1)
0 Likes
1 Solution

Accepted Solutions
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

This fixed the issue!

At the command prompt in C:\ACU910 type: marshal.exe /RegServer

View solution in original post

0 Likes
11 Replies
Micro Focus Expert
Micro Focus Expert

RE: .NET issue

Jump to solution

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

0 Likes
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

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.

0 Likes
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

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

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: .NET issue

Jump to solution

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.

0 Likes
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

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.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: .NET issue

Jump to solution

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.

0 Likes
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

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.

0 Likes
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

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.

0 Likes
Knowledge Partner
Knowledge Partner

RE: .NET issue

Jump to solution

Access to Visual Studio is quite easy these days.  Search for "Visual Studio 2015 Community download".  Free to most - check the licensing terms...


Tom Morrison
Consultant

0 Likes
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

I downloaded VS 2015 Community and changed the project from AnyCPU to x86 but still got the error so I thought maybe I need to run it through NETDefGen but when I attempted this I got the error:

Failed to extract classes. Could not load file or assembly 'file:///C:\ACU910\sample\dotnet\amortcontrol\bin\x86\Release\AmortControl.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I decided to submit a support incident. I will add the solution here if I get one.

0 Likes
SteveEly Absent Member.
Absent Member.

RE: .NET issue

Jump to solution

This fixed the issue!

At the command prompt in C:\ACU910 type: marshal.exe /RegServer

View solution in original post

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.