------------------------------ On Fri, Aug 21, 2015 8:20 PM BST Vincent Povirk wrote:
So I have a specific question - how do I go about finding out how the IL code exception comes about? (I have had a couple of patches in either camp so I am not against patching wine or mono, or wine-mono for that matter)
You can set the WINE_MONO_VERBOSE environment variable to a single digit greater than 0 to get debugging information related to JIT compilation. This should at least tell you exactly which method's IL is being rejected.
Actually I don't need that - the applicatin itself records the stack trace in its normal xml output as:
Invalid IL code in method1 (int,int,int,uint16,byte[],uint16,byte,byte,uint16[],uint16[],uint16, delegate type1): IL_039a: ldarg.s 12


and
Invalid IL code in method2 (int,int,int[],single,single,single,single,single[2],delegate type1, delegate2): IL_0098: ldarg.s 8


The first one is doing "ldarg.s <the delegate>", while the other is doing "ldarg.s <the single[2]>".
I just noticed one anomaly - the single[2] type should be a single[,] type; These are according to monodevelop's assembly browser.
Setting MONO_VERBOSE_METHOD will show debugging information for the JIT compilation of a specific method, unfortunately Mono crashes trying to parse many of the mangled names that appear in Managed C++ assemblies, so often this approach does not work for me. I've often had to hack the code that checks MONO_VERBOSE_METHOD to special-case a specific method name.
monodis somehow doesn't show either of those.
And a general question: are mixed mode assemblies supposed to work under win32 mono at all, or wine-mono definitely needed? I saw some wine + mono discussions a while ago and I got the impression that mixed mode assemblies are supposed to work with win32 mono somewhat?
There is some support for mixed-mode in win32 mono, but it is disabled by default. They are different enough that I would not use win32 mono on Windows to learn anything about how well wine-mono "should" work.
Is it possible to enable win32 mono's mixed mode support at runtime, or does it requires a re-compile?
The application itself is available as a public download in binary form. But since it mostly works - correctly under .net, and even the illegal IL exception was caught, just not the null constructor. Editing the IL code to put a try+catch around the constructor makes it largely operational too under linux mono, so there is not much of a bug to file; mostly a curiosity why wine-mono doesn't behave like it support mixed-mode fully, or not at all, but something between.
Microsoft's managed C++ compiler has been known to generate IL that technically violates ecma 335, or otherwise gives Mono trouble. We have hacks in wine-mono for a few of these cases, but it's likely we have not addressed all of them.
There are also features used by managed C++, such as "thiscall" reverse-pinvokes, which are technically independent of mixed-mode, but which are not implemented in wine-mono.
The two ldarg.s look invalid to me, but it is possible that Cecil is getting confused in the same way as mono.
Is it possible to enable win32 mono's mixed mode support at runtime, or does it requires a re-compile?
I'm not sure, but I think there is a switch to mono.exe.
The two ldarg.s look invalid to me, but it is possible that Cecil is getting confused in the same way as mono.
The solution is probably to modify the JIT compiler in wine-mono to accept this code.