I've run into a problem when using Marshal.load in Silverlight - the following exception is thrown:
NotSupportedException: Class IronRuby.Builtins.RubyObject does not have a valid deserializing constructor I tracked the code down to RubyUtils.CreateObject(RubyClass/*!*/ theclass, IEnumerable<KeyValuePair<string, object>>/*!*/ attributes). I see that CreateObject will always throw in Silverlight when the type is assignable from ISerializable: //------------------------------ public static object/*!*/ CreateObject(RubyClass/*!*/ theclass, IEnumerable<KeyValuePair<string, object>>/*!*/ attributes) { Assert.NotNull(theclass, attributes); Type baseType = theclass.GetUnderlyingSystemType(); object obj; if (typeof(ISerializable).IsAssignableFrom(baseType)) { #if !SILVERLIGHT // serialization BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; ConstructorInfo ci = baseType.GetConstructor(bindingFlags, null, _serializableTypeSignature, null); if (ci == null) { #endif string message = String.Format("Class {0} does not have a valid deserializing constructor", baseType.FullName); throw new NotSupportedException(message); #if !SILVERLIGHT // serialization } SerializationInfo info = new SerializationInfo(baseType, new FormatterConverter()); info.AddValue(SerializationInfoClassKey, theclass); foreach (var pair in attributes) { info.AddValue(pair.Key, pair.Value); } obj = ci.Invoke(new object[2] { info, new StreamingContext(StreamingContextStates.Other, theclass) }); #endif } else { obj = CreateObject(theclass); foreach (var pair in attributes) { theclass.Context.SetInstanceVariable(obj, pair.Key, pair.Value); } } return obj; } //------------------------------ Is this a bug, perhaps? I'd love to step through the code and find for myself, but I can't seem to build IronRuby using the Silverlight3 and Silverlight4 build configurations (I get a ton of errors - any help getting it to build would rock!). -Charles
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core