Thanks, This way my binder is called... But it seems I can't solve the problem that way: BindToType is never called with a wrong assemblyName (in fact each time it is called for an assemby of mine it just gives me the name of the assembly, not the full name (with the version, the culture and the key)).
Anyway, I searched more and I've found that: http://dsrg.mff.cuni.cz/projects/mono/diffs/showdiff.php?old=2004-11-05&new=2004-11-30&fileIndex=220&bench=
In System.DelegateSerializationHolder.DeserializeDelegate, they load an assembly by its full name and I think the problem is here: The deserialization asks for the delegate type (calling my BindToType), and then tries to deserialize it. The XML holds information on an assembly, and DeserializeDelegate tries to load this assembly which lead to my problem as this assembly no longer exist.
So the solution would be to change the assembly entry on the SerializationInfo given to DeserializeDelegate. How can I do that?!
I hope I've explained it well... If that helps, I thinks these guys had the same problem: http://www.x-tensive.com/Forum/viewtopic.php?t=777
I also put more information on
- the exception:
- in Crainiate.ERM4.Diagram.x16cebda0b690ada5(Stream x84378c276c4cd7e2, IFormatter xb18a47820b01ac5a)
in Crainiate.ERM4.Diagram.Open(String path, LoadFormat format)
- the serialized delegate:
<a5:MyClass id="ref-37" xmlns:a5="http://schemas.microsoft.com/clr/nsassem/MyNamespace/MyProduct">
<MyEventHandler href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-89"/>
...
</a5:MyClass>
<a3:DelegateSerializationHolder id="ref-89" xmlns:a3="http://schemas.microsoft.com/clr/ns/System">
<Delegate href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-142"/>
<target0 href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-29"/>
<method0 href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-143"/>
</a3:DelegateSerializationHolder>
<a3:DelegateSerializationHolder_x002B_DelegateEntry id="ref-142" xmlns:a3="http://schemas.microsoft.com/clr/ns/System">
<type id="ref-158">MyNamespace.MyOtherClass+MyOtherClassHandler</type>
<assembly id="ref-159">MyProduct, Version=2.2.1.0, Culture=neutral, PublicKeyToken=blahblahblah</assembly>
<target id="ref-160" xsi:type="SOAP-ENC:string">target0</target>
<targetTypeAssembly href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-159"/>
<targetTypeName id="ref-161">MyNamespace.MyOtherOtherClass</targetTypeName>
<methodName id="ref-162">MyMethod</methodName>
<delegateEntry xsi:null="1"/>
</a3:DelegateSerializationHolder_x002B_DelegateEntry>
<a9:MemberInfoSerializationHolder id="ref-143" xmlns:a9="http://schemas.microsoft.com/clr/ns/System.Reflection">
<Name href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-162"/>
<AssemblyName href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-159"/>
<ClassName href="http://support.crainiate.net/Community/forums/AddPost.aspx?ReplyToPostID=659&Quote=False#ref-161"/>
<Signature id="ref-163">Void MyMethod(System.Object)</Signature>
<MemberType>8</MemberType>
<GenericArguments xsi:null="1"/>
</a9:MemberInfoSerializationHolder>
Here I would like to change the string of ref-159 to MyProduct, Version=2.2.2.0, Culture=neutral, PublicKeyToken=blahblahblah