Bug 4440 - Incorrect System.TypeLoadException
Summary: Incorrect System.TypeLoadException
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-04-15 06:09 UTC by Jeroen Frijters
Modified: 2012-07-23 06:04 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jeroen Frijters 2012-04-15 06:09:57 UTC
Download weka-3-6-0.zip from http://sourceforge.net/projects/weka/files/weka-3-6/3.6.0/weka-3-6-0.zip/download and extract weka.jar from it.

Run ikvm (either the version that ships with Mono or a more recent):

ikvm -cp weka.jar weka.classifiers.bayes.net.search.global.GlobalScoreSearchAlgorithm

(the above all on one line)

This results in:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at cli.System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(Unknown Source)
        at IKVM.Internal.TypeWrapper.RunClassInit(Unknown Source)
        at IKVM.NativeCode.java.lang.Class.forName0(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java)
Caused by: cli.System.TypeLoadException: Could not load type 'weka.core.Tag[]' from assembly 'ikvm_dynamic_assembly__1898486584, Version=2012.415.1203.16614, Culture=neutral, PublicKeyToken=null'.

(the correct output is "Exception in thread "main" java.lang.NoSuchMethodError: main")

The IKVM runtime correctly creates the weka.core.Tag type and handles the TypeResolve event to return the proper assembly, but somehow the Mono runtime gets confused by the array type. I could not reproduce it in a trivial example.
Comment 1 Zoltan Varga 2012-04-23 07:36:25 UTC
This happens because the vtype setup for weka.core.Tag fails because of the setup_interface_offsets () mess, mono_class_setup_interface_offsets () calls it with 0 as cur_slot, meaning class->interface_offsets_packed will contain bogus values, and later calls which pass in the correct value will not update it.
Comment 2 Zoltan Varga 2012-04-23 08:37:47 UTC
Fixed in master by 628e025476f1e8781502eb9ee44bc94911229c36. We might backport the fix to the 2.10 release after some testing, since the fix involves core and pretty complex code.
Comment 3 Konrad Kruczyński 2012-07-23 04:41:40 UTC
Btw, status should be probably changed to FIXED.
Comment 4 Zoltan Varga 2012-07-23 06:04:42 UTC
-> FIXED.