- Home /
GLib: Cannot convert message. crash
I have a problem writing a .net plugin. The plugin contains only one class. During Initialisation of that class some EventHandlers are setup. Everytime i register an EventHandler
OnEvent += MyEventHandler;
Unity crashes. Before the crash a Windows message box pops up (on vista) reporting an error, but doesn't display a message. The Editor.log says this:
GLib: Cannot convert message: Conversion from character set 'UTF-8' to 'CP1252' is not supported
Any idea what's going on there?
Edit: In the editor.log just after the above line there is another error reported:
** Error **: file ....\mono\metadata\marshal.c: line 527: assertion failed: (found)
aborting...
No idea why someone triggers assertions without useful information...
Could you post the offending .net plugin (ideally with code) in a bugreport, so we can take a look at what's going on here? Thnx. Please note the case# here.
I already sent a bug report. The case number is 338557. I also made a second report with a stripped down project, but didn't receive a case number for that one so far.
Answer by Ricardo · Mar 29, 2010 at 12:23 PM
Not too long ago someone else brought up the same error message when attempting to use F#. I've seen that error before, and I consider it basically a bad stuff happened message - usually the actual error has nothing whatsoever to do with character conversion.
Is your library Unity-dependent, that is, does it use any of the UnityEngine classes? If not, you may want to try it on a standalone executable first, to a) determine if the error is actually caused by using it inside Unity, and b) try and get a better error message / stack trace.
I tried using it in a standalone and it works just fine. I wrote a C# console app, which is doing exactly the same thing (at least it should) as my Unity-Script. I don't get any errors there and it works like it's supposed to.
http://forum.unity3d.com/viewtopic.php?p=268110 Yes, it seems to be a catch-all error message
Answer by Cyclops · Mar 29, 2010 at 02:05 PM
I don't have Pro version, (can't experiment with plugins), so this is a shot in the dark :) One thing I remember reading (somewhere) is that Unity C# is slightly different in how it compiles, so that code which doesn't give an error in Visual C# Express, might do so in Unity. So even though the code is correct, I suggest modifying it anyway, trying different ways of implementing the same operation - maybe one will click with Unity.
For instance, I don't know what the rest of your code looks like or how you create your event handler, but I've seen sample code that creates and assigns it on one line, with a new, like:
b1.Click += new EventHandler(OnClick);
Try re-arranging your code, maybe something will bypass the error. Like I said, shot in the dark :) . And I presume you've put in tons of Debugging statements, made sure nothing is null, etc.
Or maybe it's not the registration - you might post the code in the Handler, maybe there's something in there Unity doesn't like. Or remove its code, turn it into a stub, see if the error persists.
I can't access the code inside the Handler as it's inside a third party handler. Thinking about what you said I'll try to install $$anonymous$$onoDevelop and see if the standalone still works when compiled with mono develop.
I tried that and also run the $$anonymous$$ono compatibility checker on my code and both didn't produce any errors. Still no clue what's going on... :(
Answer by Tony F · Aug 17, 2010 at 09:26 AM
Came across this error today - turned out to be a duplicate case statement in a switch. So not a very useful error message ...
Answer by KvanteTore · Mar 25, 2010 at 06:13 PM
Not sure, but could it be that you are targeting a newer version of CLR? Could you try to target CLR version 2.0 or older?
I set the plugins target framework to be .net 2.0, but nothing changed. It still crashes on the same line. I wrote a little class for testing purposes in .net, which does the exact same stuff as the Unity $$anonymous$$onoBehaviour I am trying to use and this works. So I suppose it's a Unity problem.