Highlighted
Absent Member.
Absent Member.
4781 views

.Net assembly error on event "Could not load file or assembly VarCallback"

[Migrated content. Thread originally posted on 01 February 2011]

My application is producing an error whenever an event is fired. The program compiles fine and there are no errors when running NetDefGen.exe. The app is running locally using the 8.1 runtime and I am able to access all public fields. The .Net assembly is written using VS2008 in VB.Net, not com visible, target CPU is any and target framework is 2.0.
The details of the error are below. Thank you for your help.


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.BadImageFormatException: Could not load file or assembly 'VarCallback, Version=1.0.0.0, Culture=neutral, PublicKeyToken=edcc9eb394a09851' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'VarCallback, Version=1.0.0.0, Culture=neutral, PublicKeyToken=edcc9eb394a09851'
at AcuCorpCallBack.Finished()
at ETi4Go.i4Go.Button39_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)




************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll


AcuToNet
Assembly Version: 8.1.0.0
Win32 Version: 8.1.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Acucorp/Acucbl810/AcuGT/bin/AcuToNet.DLL


System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll


System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll


System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll


ETi4Go
Assembly Version: 1.0.5.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Acucorp/Acucbl810/AcuGT/bin/ETi4Go.DLL


Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll


ETi4Go.i4Go
Assembly Version: 0.0.0.0
Win32 Version:
CodeBase: file:///C:/Program%20Files%20(x86)/Acucorp/Acucbl810/AcuGT/bin/ETi4Go.i4Go.DLL


Microsoft.mshtml
Assembly Version: 7.0.3300.0
Win32 Version: 7.0.3300.0
CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll


System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll


System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll



************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: .Net assembly error on event &quot;Could not load file or assembly VarCallback&quot;

I've got some more information. I found what may be the issue: http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/d1350911-f554-4299-8244-d54139d18b60.

I'm developing on a 64bit Win7 machine. I've tested on this machine and also a 32bit Windows XP Pro virtual machine with the same error. The error does not happen when I remove the event handler dll. When this handler is created, is it platform specific, does it get this setting from the assembly dll?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: .Net assembly error on event &quot;Could not load file or assembly VarCallback&quot;

Hi Joe.

It is difficult to state with such minimum of information. You say you reproduce this on a 32bit machine as well, perhaps you could provide us with a small example that reproduce the case?

One question I have is whether your event handler dll is stored along with the runtime itself (wrun32.exe) or whether it has been registered with the GAC?

If you haven't already tried this, would you mind try again but this time put a copy of the eventhandler dll along with the runtime?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: .Net assembly error on event &quot;Could not load file or assembly VarCallback&quot;

The assembly is ETi4Go.dll, the event handler is ETi4Go.i4Go.dll and both are in the runtime folder. The error states that both are being loaded from the runtime folder. What do I need to provide you as an example?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: .Net assembly error on event &quot;Could not load file or assembly VarCallback&quot;

A simple example that reproduce and how to reproduce. Source.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: .Net assembly error on event &quot;Could not load file or assembly VarCallback&quot;

The following is the cobol code. The event procedure doesn't fire until the push button titled "TEST" is pushed. The event procedure is then fired and appears to show the details from the button press event. A second press of the button causes the accept statement to fire twice and giving a message showing the contents of the field "Response". Performing any function in the assembly that would fire an event in the assembly produces the error in the original post. The more I dig it seems that the problem is related to the event handler dll.

I ran the assembly binding debugger and though the original error seems to suggest VarCallBack.dll is failing to load, the log shows a successfull load.

IDENTIFICATION DIVISION.
PROGRAM-ID. MENUS4I4.
AUTHOR. EXECU/TECH.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
COPY "\bks\acuclass.def".
COPY "\bks\ETi4Go.def"..

INPUT-OUTPUT SECTION.

FILE-CONTROL.

DATA DIVISION.
FILE SECTION.

WORKING-STORAGE SECTION.

COPY "\bks\acugui.def".
COPY "\bks\acucobol.def".
COPY "\bks\crtvars.def".
COPY "\bks\activex.def".

77 Key-Status IS SPECIAL-NAMES CRT STATUS PIC 9(5) VALUE 0.
88 Enter-Pushed VALUE 13.
88 Exit-Pushed VALUE 27.
88 Message-Received VALUE 95.
88 Event-Occurred VALUE 96.
88 Screen-No-Input-Field VALUE 97.
77 I4GO-HANDLE USAGE IS HANDLE.
77 I4GO-WINDOW HANDLE OF WINDOW.
77 I4GORESPONSE PIC X(10).

77 EXCP PIC 999.
77 WORK1X PIC X.
LINKAGE SECTION.
01 PASSING-DATA-FIELDS.
03 TODAY-IS PIC 9(6).
03 PASS-SWITCH PIC X(8).
03 PRINTERX PIC X(14).
03 GLCCOMPANY PIC XX.
03 GLCNAME PIC X(30).
03 GLCEMP PIC XXXX.
03 PASS-FILLER PIC X(512).

SCREEN SECTION.
01 I4GO-SCREEN.
03 I4GO-CONTROL "ETi4Go",
NAMESPACE IS "ETi4Go",
CLASS-NAME IS "i4Go",
LINE 1 COL 1,
EVENT PROCEDURE IS I4GO-EVENT.
03 PUSH-BUTTON LINE 35 COL 10 TITLE "TEST".

PROCEDURE DIVISION USING PASSING-DATA-FIELDS.


DECLARATIVES.
INPUT-ERROR SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON INPUT.
0100-DECL.
EXIT.
I-O-ERROR SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON I-O.
0200-DECL.
EXIT.
OUTPUT-ERROR SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON OUTPUT.
0300-DECL.
EXIT.
0400-DECL.
EXIT.
END DECLARATIVES.

MAIN-LOGIC.
DISPLAY FLOATING WINDOW
SIZE 110 LINES 35
HANDLE I4GO-WINDOW BOXED
TITLE "Swipe card or enter cardholder information".

DISPLAY I4GO-SCREEN UPON I4GO-HANDLE.
INITIALIZE Key-Status.

ACCLOOP.
PERFORM UNTIL Event-Occurred
ACCEPT I4GO-SCREEN
ON EXCEPTION PERFORM READ-VARS
END-ACCEPT
END-PERFORM.

READ-VARS.
INQUIRE I4GO-CONTROL Response IN I4GORESPONSE
DISPLAY MESSAGE I4GORESPONSE.

EXIT-STOP-ROUTINE.
INITIALIZE PASS-SWITCH.
EXIT PROGRAM.

I4GO-EVENT.
DISPLAY MESSAGE EVENT-TYPE ":" EVENT-DATA-2.
EVALUATE EVENT-TYPE
WHEN MSG-NET-EVENT
EVALUATE EVENT-DATA-2
WHEN @i4Go_Finished
DISPLAY MESSAGE "EVENT"
END-EVALUATE
END-EVALUATE.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: .Net assembly error on event &quot;Could not load file or assembly VarCallback&quot;

I have an update. I decided to add VarCallBack.dll to the windows\assembly folder and noticed that the my 8.10 dll was shown as 64bit. I have an 8.13 runtime folder so I added it to the windows\assembly and it's compiled for any processor. I moved it to the 8.10 runtime folder and now the event is firing without error and the cobol app is detecting it.

Is there an 8.10 version of this dll that's compiled for any processor?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: .Net assembly error on event &quot;Could not load file or assembly VarCallback&quot;

Hi Joe

I am glad you worked it out. It is unfortunately not so uncommon that the wrong DLL get picked up.

As to versions and hosts, if you are missing modules of the runtime system I suggest you contact technical support for help on that.
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.