- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.JavaScript pack. It includes chart, diagram, calendar, map, virtual keyboard, gauge and UI components. Here are more details and live demo for anyone interested.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Pages: 1 2  Send Topic Print  
Exception in LoadFromStream when strong named key file changed
Read 4551 times

Slavcho   Offline
God Member
*****
Posts: 1802
Gender: male
tech.support


   
     
 
Re: Exception in LoadFromStream when strong named key file changed
Reply #15 - Feb 13th, 2017 at 7:09am
 
Based on answers from http://stackoverflow.com/questions/5794686/serializationbinder-with-listt, this fixed the Dictionary<string, MyTag> exception for me -

Code:
public override Type BindToType(string assemblyName, string typeName)
{
	if (assemblyName.StartsWith(Assembly.GetExecutingAssembly().GetName().Name))
		return Assembly.GetExecutingAssembly().GetType(typeName);
	if (typeName.Contains("[["))
		return Type.GetType(StripAsmStrongName(typeName));
	return null;
}

string StripAsmStrongName(string genericTypeName)
{
	while (true)
	{
		int index1 = genericTypeName.IndexOf(", Version");
		if (index1 == -1)
			return genericTypeName;
		int index2 = index1 + genericTypeName.Substring(index1).IndexOf("]");
		genericTypeName = genericTypeName.Remove(index1, index2 - index1);
	}
} 



Regards,
Slavcho
Mindfusion
 
 
 
IP Logged    
 
     

David Long   Offline
Junior Member
**
Posts: 85
Gender: male
England
I love YaBB 1G - SP1!


   
     
 
Re: Exception in LoadFromStream when strong named key file changed
Reply #16 - Feb 15th, 2017 at 10:16pm
 
Sorry for delay, I did not see the second page of postings (the page numbers are very small or maybe I need new glasses!)

Your solution works perfectly Smiley Many thanks - with the right search terms StackOverflow often comes up with the answer. I don't think I searched for the right thing.

Thanks again,
DavidL
 
 
 
IP Logged    
 
     
Pages: 1 2  Send Topic Print