System.MissingMethodException on 2 systems, not on 2 others (probably solved)

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

System.MissingMethodException on 2 systems, not on 2 others (probably solved)

Post by ic2 »

I have an X# program which runs on my machine and I installed it for a client. Both work. Now Kees used it too and on his machine it didn't start. Application log shows KERNELBASE.dll as faulty module, but as usual for Microsoft none of the log entries are of any use.

So I copied the exe on a laptop where it failed as well, this time with:

Code: Select all

Description: The process was terminated due to an unhandled exception.
Exception Info: System.MissingMethodException
   at <Module>.$AppInit()
   at MyProgram,Exe.Functions.Start()
In posts with this error incorrect DLL's are suggested as the cause, but even when I copy all DLL's from the working Pc and start my program in a DOS prompt with Set Path = c:MyProgramDir I get the same error. It doesn't even reach the first line in the Constructor.

I then copied the full VS program/solution directories from the Pc to the laptop to debug it there. Originally it didn't compile there because it needed a reference to System.Windows.Forms (it's a WPF program with some Winforms command). No idea why it worked without on my Pc (there is a System.Windows reference which I'd say should be enough) but: adding the reference helped and the program compiled and the exe, once copied to the working directory, worked.

So I added this same reference to the Pc solution, which should make it equal to the laptop solution and thought this issue would somehow be caused by this "missing" reference. I copied the resulting exe from the Pc to the laptop, but got the same System.MissingMethodException again. This while the exe created on the laptop, which should be the same as the one created on the Pc (and copied to the same location with the same DLL's), works.....

EDIT/NOTE: I think I just solved it, at least the reason my Pc version didn't work on the laptop. I realized that the laptop's X# was a few versions behind. I installed the same versions as on my Pc and saw that the option Register runtime DLLs in the GAC (recommended !) was still checked. I unchecked it, installed, recreated the exe (on the Pc) which worked as it did, then copied the exe from the PC and now it worked. Next to check is Kees' system (I'll let you know)

So I lost (again, I see that I had this earlier) time because of that piece of Microsoft shit called the GAC. I can recommend not to recommend to check this box.

Dick
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

System.MissingMethodException on 2 systems, not on 2 others (probably solved)

Post by robert »

Dick,
The

Code: Select all

<Module>.$AppInit()
is a method that is generated by the X# compiler. It is called at startup and it calls all $Init1(), $Init2() (if any) and $Init3() (if any) methods in the function classes of the X# compiled assemblies that you have linked to your app.
These compiler generated $Init1() .. $Init3() methods call the code in so called INIT PROCEDURES.
Do you have any INIT procedures in your code (PROCEDURE MyProc _INIT1 for example)?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

System.MissingMethodException on 2 systems, not on 2 others (probably solved)

Post by ic2 »

Hello Robert,
robert wrote: Do you have any INIT procedures in your code (PROCEDURE MyProc _INIT1 for example)?
No, none at all.

Dick
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

System.MissingMethodException on 2 systems, not on 2 others (probably solved)

Post by robert »

Dick,
Then most likely you did not include one of the DLLs that you have in the references list of your app.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

System.MissingMethodException on 2 systems, not on 2 others (probably solved)

Post by Chris »

Robert,

The problem was that Dick was just using a very old X# build in the other machine (so also had in the GAC very older runtime than the one his assemblies, were built against), he mentioned this in an edit of his firs post. After installing the latest build, it all worked fine.

.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply