The following code causes the script to crash for no reason:
key getKey( ) {
return NULL_KEY;
}
default {
state_entry() {
llMessageLinked( LINK_SET, 18, "", "" );
}
link_message( integer sender_num, integer channel, string message, key id ) {
key newKey;
newKey = getKey( );
}
}
Error output:
[0:02] Object [script:New Script]: Script run-time error
[0:02] Object [script:New Script]: System.InvalidProgramException: Invalid IL code in LSL_dd7aedc1_fa98_0dc0_b564_8ccc28cce173:edefaultlink_message (int,int,string,LindenLab.SecondLife.Key): IL_0087: stloc.0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
This error is mono-specific - and does not happen with the LSL interpreter.
key returnakey() {
return NULL_KEY;
}
default {
state_entry() { key t = returnakey(); }
}
[7:53] Object [script:New Script]: Script run-time error
[7:53] Object [script:New Script]: System.InvalidProgramException: Invalid IL code in LSL_ea65065c_d1d1_b23d_9c55_2c37c11995c7:edefaultstate_entry (): IL_007b: stloc.0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
It doesn't happen when the returned key is simply discarded, or when the key is returned directly from a system function (e.g. llGetKey).