Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Diagram.cs FormatException-FromBase64String (Read 6597 times)
bhadri
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jun 30th, 2009
Diagram.cs FormatException-FromBase64String
Jun 30th, 2009 at 1:34pm
Print Post  
I Am having an issue on MindFusion.Diagramming.dll, Am getting “System.FormatException - Invalid length for a Base-64 char array” Error on the D:\FCNetSrc\fcnpro.src.vs2003\FlowChart.NET\MindFusion.Diagramming\Diagram.cs(5
14):
public void LoadFromString(string str), While opening the Saved diagram.

FCNetSrc\fcnpro.src.vs2003\FlowChart.NET\MindFusion.Diagramming\Diagram.cs(524):

buf = System.Convert.FromBase64String(str)


Error Description:

DiagramView1.Diagram.LoadFromString(StrXml)
Run-time exception thrown : System.FormatException - Invalid length for a Base-64 char array.
Message "Invalid length for a Base-64 char array."


Please let me know how to resolve this Issue.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.cs FormatException-FromBase64String
Reply #1 - Jun 30th, 2009 at 6:43pm
Print Post  
Which version of the control are you using? I can see you have built the flowchart.net assemblies from the vs2003 source code - are you using them under .NET 1.1 or .NET 2?
  
Back to top
 
IP Logged
 
bhadri
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jun 30th, 2009
Re: Diagram.cs FormatException-FromBase64String
Reply #2 - Jul 1st, 2009 at 12:29pm
Print Post  
MindFusion.Diagramming.dll Version 5.0.2.35462.

Yes, I have built the flowchart.net assemblies from the vs2003 source code and using in Dot Net framework 2.0 in client machine because we have merged several dll's into one using Dot Net framework 2.0 ILMerge command. But this issue is raising in a particular Diagram which is important for us. and also created and saved in same version of the diagram control.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.cs FormatException-FromBase64String
Reply #3 - Jul 1st, 2009 at 2:08pm
Print Post  
What SaveToStringFormat value do you use when calling SaveToString?
  
Back to top
 
IP Logged
 
bhadri
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jun 30th, 2009
Re: Diagram.cs FormatException-FromBase64String
Reply #4 - Jul 2nd, 2009 at 4:12pm
Print Post  
Support Team:

Thanks for your quick reply. we are using the following method to save the Charts.

'Saving the FlowChart
    <ComVisible(True)> Public Function SaveFromActiveX() As String
       Try
           Dim StrStream As String = String.Empty
           StrStream = DiagramView1.Diagram.SaveToString
           Return StrStream
       Catch ex As System.OutOfMemoryException
           MessageBox.Show("The Uploaded images are more in size.", "TapRooT® System Software" _
                          , MessageBoxButtons.OK _
                          , MessageBoxIcon.Information _
                          )
       Catch ex As Exception
           MessageBox.Show(ex.StackTrace, "TapRooT® System Software" _
                          , MessageBoxButtons.OK _
                          , MessageBoxIcon.Information _
                          )
       End Try
    End Function


we are using FlowCharT.Net Control as ActiveX control, from ActiveX control we are sending the Diagram String to Aspx page. from .Aspx page it saves into the database.

thanks
Bhadri
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.cs FormatException-FromBase64String
Reply #5 - Jul 2nd, 2009 at 6:58pm
Print Post  
The string might get truncated because of the ASP.NET maximum request size. You can see how to set a larger request size here:
http://forums.asp.net/t/1297911.aspx

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bhadri
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jun 30th, 2009
Re: Diagram.cs FormatException-FromBase64String
Reply #6 - Jul 3rd, 2009 at 1:49pm
Print Post  
Stoyo:

we are using <httpRuntime executionTimeout="6000" maxRequestLength="104801"/> in our web.config. 
I hope String Data will not be truncated. we have saved/retrieved larger size charts than Chart which we got Error.

Thanks
Bhadri
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.cs FormatException-FromBase64String
Reply #7 - Jul 3rd, 2009 at 2:24pm
Print Post  
What happens if you call just diagram.LoadFromString(diagram.SaveToString()), without sending the string to the server and back?
  
Back to top
 
IP Logged
 
bhadri
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jun 30th, 2009
Re: Diagram.cs FormatException-FromBase64String
Reply #8 - Jul 3rd, 2009 at 2:37pm
Print Post  
Stoyo:
 
I had tried diagram.LoadFromString(diagram.SaveToString()) no errors.

As I have AllReady Explained that we are not getting this issue with all CharTs, few of our customers got this issue. however we are unable to reproduce this issue.

thanks
bhadri
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.cs FormatException-FromBase64String
Reply #9 - Jul 4th, 2009 at 12:59pm
Print Post  
Bhadri,

We use the System.Convert methods to encode and decode base64 strings, and LoadFromString calls Convert.FromBase64String before running the diagram deserialization code. Now if this method throws an "Invalid length for a Base-64 char array" exception, the only possible reason is that the string was not transferred successfully either from the client to the server when saving the diagram, or from the server to the client when loading it. Do your clients run the application on their own servers, or they connect to yours?

Stoyan
  
Back to top
 
IP Logged
 
bhadri
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jun 30th, 2009
Re: Diagram.cs FormatException-FromBase64String
Reply #10 - Jul 6th, 2009 at 7:11am
Print Post  
Yes, clients run the application on their own servers.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.cs FormatException-FromBase64String
Reply #11 - Jul 6th, 2009 at 11:36am
Print Post  
If it was running on your server you could check the database for incorrectly transferred strings by calling the System.Convert.FromBase64String method on them. Try using that method after each transfer to check if the received value is correct, and retry sending it if it throws a FormatException.
  
Back to top
 
IP Logged
 
bhadri
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Jun 30th, 2009
Re: Diagram.cs FormatException-FromBase64String
Reply #12 - Jul 6th, 2009 at 2:42pm
Print Post  
Stoyo:

Which coloumn Datatype is compatible for storing the diagram.SaveToString() into MS SQL 2000/2005 Database?

Thanks
Bhadri
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Diagram.cs FormatException-FromBase64String
Reply #13 - Jul 7th, 2009 at 6:08am
Print Post  
I suppose it should be a VARCHAR(MAX) field.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint