Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Reading files created with an older WinForms version of MindFusion (Read 1252 times)
David Long
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 87
Location: England
Joined: Oct 23rd, 2006
Reading files created with an older WinForms version of MindFusion
Jun 7th, 2018 at 3:46pm
Print Post  
I'm writing an ASP .NET version of software I have previously written with WinForms/Diagramming for Winforms and would like to read files created with that older software.  The error I get on a file read is:

"Could not load file or assembly 'MindFusion.Common, Version=1.3.1.18503, Culture=neutral, PublicKeyToken=7fed53ada5b92263' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

So the old data file is referencing types in an older copy of MindFusion.Common.dll with a different version and PublicKeyToken.  The differing PublicKeyToken means that I cannot use a bindingRedirect in Web.config, so after a web search I have come up with the following which I have added to web.config

<dependentAssembly>
        <assemblyIdentity name="MindFusion.Common" Culture="neutral" publicKeyToken="7fed53ada5b92263"/>
        <codebase version="1.3.1.18503" href="WinForms\MindFusion.Common.dll" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="MindFusion.Common" Culture="neutral" publicKeyToken="dd7449df9ffcc455"/>
        <codebase version="1.3.2.450" href="WebForms\MindFusion.Common.dll" />
      </dependentAssembly>

I have created two separate folders (WinForms and WebForms) that contain the two sets of DLLs, but I still get the same error every time.

Any help gratefully received.
DavidL

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 1974
Joined: Oct 19th, 2005
Re: Reading files created with an older WinForms version of MindFusion
Reply #1 - Jun 8th, 2018 at 8:16am
Print Post  
I think the SerializationBinder property we discussed some time ago should help for this too -
https://mindfusion.eu/Forum/YaBB.pl?num=1486395394/15#15

Regards,
Slavcho
  
Back to top
 
IP Logged
 
David Long
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 87
Location: England
Joined: Oct 23rd, 2006
Re: Reading files created with an older WinForms version of MindFusion
Reply #2 - Jun 8th, 2018 at 2:54pm
Print Post  
That seems to partially work.  The SerializationBinder tells my web application where to find the box tag class, an object of which is attached to each chart box.  But the box tags contain a MindFusion.Drawing.Pen and the SerialisationBinder does not seem to be called again to allow me to specify the new ASP .NET version of MindFusion.Common.dll that is part of my web application.  Is the Pen class in these two DLLs actually compatible?  Maybe it does not work for a reason!

Note:  I've also tried the AssemblyResolve route, but that gives the same result...

        void Application_Start(object sender, EventArgs e)
        {

            
            // Add event handler for Assembly resolution
            AppDomain.CurrentDomain.AssemblyResolve += AssembleyResolveEventHandler;
        }

        private static Assembly AssembleyResolveEventHandler(object sender, ResolveEventArgs args)
        {
            var name = new AssemblyName(args.Name);

            if (name.Name == "MindFusion.Common")
            {
                Type t = typeof(MindFusion.Drawing.Pen);
                Assembly a = Assembly.GetAssembly(t);
                return a;
            }

            return null;
        }

I appreciate that this may be more of a .NET problem than a MindFusion one, but any help appreciated.
DavidL
  
Back to top
 
IP Logged
 
David Long
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 87
Location: England
Joined: Oct 23rd, 2006
Re: Reading files created with an older WinForms version of MindFusion
Reply #3 - Jun 11th, 2018 at 8:20am
Print Post  
Come to think of it - I think that I can add a feature to the desktop version of my software - a sort of 'Prepare for Web' feature that re-writes the box tags to be more in line with the features of the web version.

No more help needed.
DavidL
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 1974
Joined: Oct 19th, 2005
Re: Reading files created with an older WinForms version of MindFusion
Reply #4 - Jun 11th, 2018 at 9:04am
Print Post  
The custom binder should be used both for the root Tag object and is also assigned as BinaryFormatter.Binder. Are you saving in XML or binary format, and in what way does the root tag object save pens?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint